         let minY = (height - CGFloat(numberOfSections) * (self.cellSize.height + self.cellSpace) + self.cellSpace) / 2
         for section in 0..<numberOfSections {
             let numberOfItems = self.collectionView!.numberOfItemsInSection(section)
-            let minX = (width - CGFloat(numberOfItems) * (self.cellSize.width + self.cellSpace) + self.cellSpace) / 2
-            for item in 0..<numberOfItems {
-                let indexPath = NSIndexPath(forItem: item, inSection: section)
+            let minX = (width - CGFloat(rowsCount) * (self.cellSize.width + self.cellSpace) + self.cellSpace) / 2
+            for row in 0..<numberOfItems {
+                let indexPath = NSIndexPath(forRow: row, inSection: section)
                 let attributes = MSTumblrMenuLayoutAttributes(forCellWithIndexPath: indexPath)
                 attributes.size = self.cellSize
-                attributes.center = CGPointMake(minX + CGFloat(indexPath.row) * (self.cellSize.width + self.cellSpace) + self.cellSize.width / 2, minY + CGFloat(indexPath.section) * (self.cellSize.height + self.cellSpace) + self.self.cellSize.height / 2)
+                attributes.center = CGPointMake(minX + CGFloat(indexPath.row) * (self.cellSize.width + self.cellSpace) + self.cellSize.width / 2, minY + CGFloat(indexPath.section) * (self.cellSize.height + self.cellSpace) + self.cellSize.height / 2)
                 self.cachedAttributes[indexPath] = attributes
             }
         }

        if self.indexPathsToAnimate.indexOf(itemIndexPath) == nil {
            return super.finalLayoutAttributesForDisappearingItemAtIndexPath(itemIndexPath)
        }
        var offset = self.collectionViewContentSize().height + 300 * CGFloat(self.collectionView!.numberOfSections() - 1 - itemIndexPath.section) * CGFloat((self.collectionView!.numberOfItemsInSection(itemIndexPath.section)))
        if itemIndexPath.row == 0 {
            offset -= 300
        } else if itemIndexPath.row == 2 {
            offset -= 600
        }
        var delay = 0.1 * Double(itemIndexPath.section) * Double((self.collectionView!.numberOfItemsInSection(itemIndexPath.section)))
        if itemIndexPath.row == 0 {
            delay += 0.1
        } else if itemIndexPath.row == 2 {
            delay += 0.1 * 2
        }

        let transformAnimation = CABasicAnimation(keyPath: "position.y")
        transformAnimation.duration = 0.3
        transformAnimation.fromValue = offset + CGFloat(itemIndexPath.section) * (cellSize.height + cellSpace)
        transformAnimation.toValue = 200 + CGFloat(itemIndexPath.section) * (cellSize.height + cellSpace)
        transformAnimation.timingFunction = CAMediaTimingFunction(controlPoints: 0.45, 1.2, 0.75, 1.0)
        transformAnimation.removedOnCompletion = false
        transformAnimation.fillMode = kCAFillModeForwards
        transformAnimation.beginTime = CACurrentMediaTime() + delay

        let attributes = MSTumblrMenuLayoutAttributes(forCellWithIndexPath: itemIndexPath)
        attributes.alpha = 1.0
        attributes.animation = transformAnimation
        attributes.size = self.cellSize
        attributes.center = CGPointMake(CGFloat(itemIndexPath.row) * (cellSize.width + cellSpace) + cellSize.width / 2,  -offset + CGFloat(itemIndexPath.section) * (cellSize.height + cellSpace) + cellSize.height / 2)
        return attributes
    }


    }

    override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
        return self.cachedAttributes.map({ (_, attributes) -> UICollectionViewLayoutAttributes in
            return attributes
        }).filter { attributes -> Bool in
            return CGRectIntersectsRect(attributes.frame, rect)
        }
    }

    override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
