         height: aCellSize.height * cellSize.height
       )
     }
-
-    return result
-  }
-
+    
+    return CGRectIntegral(result)
+  }
+  
   private func sizeForCellAtIndexPath(indexPath: NSIndexPath) -> CGSize {
-    if let cv = collectionView, let d = delegate {
-      if d.respondsToSelector("collectionView:layout:sizeForItemAtIndexPath:") {
-        return d.collectionView(cv, layout: self, sizeForItemAtIndexPath: indexPath)
-      }
-      }
-
+    if let d = delegate {
+      return d.collectionView(collectionView!, layout: self, sizeForItemAtIndexPath: indexPath)
+    }
+    
     return CGSize(width: 1.0, height: 1.0)
   }
-
+  
   private func positionForIndexPath(indexPath: NSIndexPath) -> CGPoint {
     let position: CGPoint
     // Check if the cell has a position
     if let p = positionByIndexPath[UInt(indexPath.section)]?[UInt(indexPath.row)] {
-      position = p.CGPointValue()
-
-    }
-
+      position = p
+      
+    }
+      
     else {
       // Make a new position if the position did not exist.
       insertCellsToIndexPath(indexPath)
-
-      position = positionByIndexPath[UInt(indexPath.section)]?[UInt(indexPath.row)]?.CGPointValue()
-        ?? CGPointZero
-    }
-
-
+      
+      position = positionByIndexPath[UInt(indexPath.section)]?[UInt(indexPath.row)] ?? CGPointZero
+    }
+    
     return position
   }
-
+  
   private func indexPathForPosition(position: CGPoint) -> NSIndexPath? {
     let unboundIndex, boundIndex: Int
-
+    
     switch scrollDirection {
     case .Vertical:
       unboundIndex = Int(position.y)
       boundIndex = Int(position.x)
-
+      
     case .Horizontal:
       unboundIndex = Int(position.x)
       boundIndex = Int(position.y)
     }
-
+    
     return indexPathByPosition[boundIndex]?[unboundIndex]
   }
 }

  private func traverseOpenCells(closure: (position: CGPoint) -> Bool) -> Bool {
    var allTakenBefore = true
    var unboundIndex: UInt

    switch scrollDirection {
    case .Vertical:
      unboundIndex = UInt(firstOpenSpace.y)

    case .Horizontal:
      unboundIndex = UInt(firstOpenSpace.x)
    }

    repeat {
      for boundIndex in 0..<maximumNumberOfCellsInBounds {
        var position = CGPointZero

        switch scrollDirection {
        case .Vertical:
          position = CGPoint(x: CGFloat(boundIndex), y: CGFloat(unboundIndex))

        case .Horizontal:
          position = CGPoint(x: CGFloat(unboundIndex), y: CGFloat(boundIndex))
        }


        if indexPathForPosition(position) != nil {
          continue
        }

        if allTakenBefore {
          firstOpenSpace = position
          allTakenBefore = false
        }

        if !closure(position: position) {
          // break
          return false
        }
      }

      unboundIndex += 1
      
    } while(true)

          let hasSpaceAvailable: Bool = Bool(self.indexPathForPosition(position) == nil)
          var isInBounds: Bool = false
          var hasMaximumBoundSize: Bool = false
          
          switch self.scrollDirection {
          case .Vertical:
            isInBounds = (UInt(position.x) < self.maximumNumberOfCellsInBounds);
