     }
 
     override func finalizeCollectionViewUpdates() {
-        self.indexPathsToAnimate = nil
+        self.indexPathsToAnimate = [NSIndexPath]()
     }
 
 


class MSTumblrMenuFlowLayout: UICollectionViewLayout {

    let cellSize = CGSizeMake(100, 100)
    let cellSpace: CGFloat = 30.0
    var indexPathsToAnimate : Array<NSIndexPath>!
    var cachedAttributes = [NSIndexPath: MSTumblrMenuLayoutAttributes]()

    override func prepareLayout() {
        super.prepareLayout()
        cachedAttributes.removeAll(keepCapacity: false)
        for section in 0..<self.collectionView!.numberOfSections() {
            for item in 0..<self.collectionView!.numberOfItemsInSection(section) {
                let indexPath = NSIndexPath(forItem: item, inSection: section)
                let attributes = MSTumblrMenuLayoutAttributes(forCellWithIndexPath: indexPath)
                attributes.size = self.cellSize
                attributes.center = CGPointMake(CGFloat(indexPath.row) * (cellSize.width + cellSpace) + cellSize.width / 2, 200 + CGFloat(indexPath.section) * (cellSize.height + cellSpace) + cellSize.height / 2)
                cachedAttributes[indexPath] = attributes
            }
        }

        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)
