Index: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFormClosure.cs
===================================================================
--- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFormClosure.cs	(revision 15770)
+++ branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFormClosure.cs	(revision 15801)
@@ -10,5 +10,5 @@
 
 namespace HeuristicLab.Problems.BinPacking3D.Packer {
-  internal class BinPackerFormClosure : BinPacker {
+  internal class BinPackerFormClosure : BinPackerMinRSLeft {
 
     #region Constructors for HEAL
@@ -25,66 +25,53 @@
     public BinPackerFormClosure() : base() { }
 
-    /// <summary>
-    /// 
-    /// </summary>
-    /// <param name="sortedItems"></param>
-    /// <param name="binShape"></param>
-    /// <param name="items"></param>
-    /// <param name="epCreationMethod"></param>
-    /// <param name="epPruningMethod"></param>
-    /// <param name="useStackingConstraints"></param>
-    /// <returns></returns>
-    public override IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) {
-      var workingItems = CloneItems(items);
-      IList<BinPacking3D> packingList = new List<BinPacking3D>();
-      IList<int> remainingIds = new List<int>(sortedItems);
+
+    protected override void PackRemainingItems(ref IList<int> remainingIds, ref BinPacking3D packingBin, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, bool useStackingConstraints) {
       IExtremePointCreator extremePointCreator = ExtremePointCreatorFactory.CreateExtremePointCreator(epCreationMethod, useStackingConstraints);
-
-      try {
-        var groupedItems = items.Select((x, index) => new { Item = x, Id = index })
-                                .GroupBy(x => x.Item.Layer)
-                                .OrderBy(x => x.Key);
-
-        BinPacking3D packingBin = new BinPacking3D(binShape);
-        packingList.Add(packingBin);
-        foreach (var grouping in groupedItems) {
-          var notPacked = new List<KeyValuePair<int, PackingItem>>();
-          var gr = grouping.ToList();
-          var selectedItems = gr.Where(x => ItemBinWidth(x.Item, binShape))
-                                .OrderByDescending(x => x.Item.Width)
-                                .ThenByDescending(x => x.Item.Height)
-                                .ThenByDescending(x => x.Item.Depth);
-          var otherItems = gr.Except(selectedItems).OrderByDescending(x => x.Item.Width * x.Item.Height);
-          foreach (var item in selectedItems) {
-            if (TryToPack(packingBin, item.Item, item.Id, extremePointCreator, useStackingConstraints)) {
-              remainingIds.Remove(item.Id);
-            } else {
-              notPacked.Add(new KeyValuePair<int, PackingItem>(item.Id, item.Item));
-            }
-          }
-          foreach (var item in otherItems) {
-            if (TryToPack(packingBin, item.Item, item.Id, extremePointCreator, useStackingConstraints)) {
-              remainingIds.Remove(item.Id);
-            } else {
-              notPacked.Add(new KeyValuePair<int, PackingItem>(item.Id, item.Item));
-            }
-          }
-
-          while (notPacked.Count > 0) {
-            packingBin = new BinPacking3D(binShape);
-            packingList.Add(packingBin);
-
-            foreach (var item in notPacked.ToList()) {
-              if (TryToPack(packingBin, item.Value, item.Key, extremePointCreator, useStackingConstraints)) {
-                remainingIds.Remove(item.Key);
-                notPacked.Remove(item);
-              }
-            }
-          }
+      // If there are any items which width equals to the bin shape width or the result of a modulo division of the width is zero, these items will be packed first
+      //schauen, ob es einen gegenstand gibt, der die ganze breite ausfuellt oder bei einer division mit der breite ein rest von 0 rauskommt.
+      var binShape = packingBin.BinShape;
+      var placeable = remainingIds.ToList().Where(x => ItemFitsBinShapeWidth(x, items[x], binShape))
+                                           .OrderByDescending(x => items[x].Width)
+                                           .ThenByDescending(x => items[x].Height);
+      foreach (var itemId in placeable) {
+        var item = items[itemId];
+        if (TryToPack(packingBin, item, itemId, extremePointCreator, useStackingConstraints)) {
+          remainingIds.Remove(itemId);
         }
-      } catch { }
+      }
+      base.PackRemainingItems(ref remainingIds, ref packingBin, items, epCreationMethod, useStackingConstraints);
+    }
 
 
-      return packingList;
+      private bool ItemFitsBinShapeWidth(int itemId, PackingItem item, PackingShape binShape) {
+      item.Rotated = false;
+      item.Tilted = false;
+      if (binShape.Width % item.Width == 0) {
+        return true;
+      }
+
+      if (item.RotateEnabled && !item.TiltEnabled) {
+        item.Rotated = true;
+        if (binShape.Width % item.Width == 0) {
+          return true;
+        }
+      }
+      if (!item.RotateEnabled && item.TiltEnabled) {
+        item.Rotated = false;
+        item.Tilted = true;
+        if (binShape.Width % item.Width == 0) {
+          return true;
+        }
+      }
+      if (item.RotateEnabled && item.TiltEnabled) {
+        item.Rotated = true;
+        item.Tilted = true;
+        if (binShape.Width % item.Width == 0) {
+          return true;
+        }
+      }
+      item.Rotated = false;
+      item.Tilted = false;
+      return false;
     }
 
@@ -98,51 +85,4 @@
       return false;
     }
-
-    protected override PackingPosition FindPackingPositionForItem(BinPacking3D packingBin, PackingItem packingItem, bool useStackingConstraints) {
-      if (!CheckItemDimensions(packingBin, packingItem)) {
-        throw new BinPacking3DException($"The dimensions of the given item exceeds the bin dimensions. " +
-          $"Bin: ({packingBin.BinShape.Width} {packingBin.BinShape.Depth} {packingBin.BinShape.Height})" +
-          $"Item: ({packingItem.Width} {packingItem.Depth} {packingItem.Height})");
-      }
-
-      var newPosition = packingBin.ExtremePoints.Where(x => packingBin.IsPositionFeasible(packingItem, x.Key, useStackingConstraints)).FirstOrDefault();
-
-      return newPosition.Key;
-    }
-
-
-    private static bool ItemBinWidth(PackingItem item, PackingShape bin) {
-      var itemCopy = item.Clone() as PackingItem;
-      int binWith = bin.Width;
-      if (itemCopy.Width <= binWith && binWith % itemCopy.Width == 0) {
-        return true;
-      }
-
-      itemCopy.Rotated = true;
-      if (itemCopy.Width <= binWith && binWith % itemCopy.Width == 0) {
-        item.Rotated = true;
-        return true;
-      }
-
-      itemCopy.Rotated = false;
-      itemCopy.Tilted = true;
-      if (itemCopy.Width <= binWith && binWith % itemCopy.Width == 0) {
-        item.Tilted = true;
-        return true;
-      }
-
-      itemCopy.Rotated = true;
-      itemCopy.Tilted = true;
-      if (itemCopy.Width <= binWith && binWith % itemCopy.Width == 0) {
-        item.Rotated = true;
-        item.Tilted = true;
-        return true;
-      }
-      return false;
-    }
-
-    public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) {
-      throw new NotImplementedException();
-    }
   }
 }
Index: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs
===================================================================
--- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs	(revision 15770)
+++ branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs	(revision 15801)
@@ -94,4 +94,5 @@
       ExtremePointPruningFactory.CreatePruning().PruneExtremePoints(epPruningMethod, packingList);
     }
+
     
 
@@ -104,6 +105,7 @@
     /// <param name="epCreationMethod"></param>
     /// <param name="useStackingConstraints"></param>
-    protected void PackRemainingItems(ref IList<int> remainingIds, ref BinPacking3D packingBin, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, bool useStackingConstraints) {
+    protected virtual void PackRemainingItems(ref IList<int> remainingIds, ref BinPacking3D packingBin, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, bool useStackingConstraints) {
       IExtremePointCreator extremePointCreator = ExtremePointCreatorFactory.CreateExtremePointCreator(epCreationMethod, useStackingConstraints);
+
       var remainingNotWeightSupportedItems = new List<int>();
       foreach (var itemId in new List<int>(remainingIds)) {
@@ -149,5 +151,4 @@
           }
         }
-
       }
     }
