                     changes[changeType] = [deleteIndexPath]
                 }
             case .Update:
-                if let i = indexPath {
-                    changes[changeType] = [i]
+                if let indexPath = indexPath {
+                    changes[changeType] = [indexPath]
                 }
             case .Move:
                 if let old = indexPath, new = newIndexPath {


    private func applyObjectChanges() {
        for eachChange in objectChanges {
            for (changeType, indexes): (NSFetchedResultsChangeType, [NSIndexPath]) in eachChange {

                switch(changeType) {
                case .Insert: collectionView?.insertItemsAtIndexPaths(indexes)
                case .Delete: collectionView?.deleteItemsAtIndexPaths(indexes)
                case .Update: collectionView?.reloadItemsAtIndexPaths(indexes)
                case .Move:
                    if let first = indexes.first, last = indexes.last {
                        collectionView?.moveItemAtIndexPath(first, toIndexPath: last)
                    }
                }

        willChangeContent(controller)
    }

    @objc func controller(controller: NSFetchedResultsController,
        didChangeSection sectionInfo: NSFetchedResultsSectionInfo,
        atIndex sectionIndex: Int,
        forChangeType type: NSFetchedResultsChangeType) {
            didChangeSection(controller, sectionInfo, sectionIndex, type)
    }

    @objc func controller(controller: NSFetchedResultsController,
        didChangeObject anObject: NSManagedObject,
        atIndexPath indexPath: NSIndexPath?,
        forChangeType type: NSFetchedResultsChangeType,
        newIndexPath: NSIndexPath?) {
            didChangeObject(controller, anObject, indexPath, type, newIndexPath)
    }

    @objc func controllerDidChangeContent(controller: NSFetchedResultsController) {
        didChangeContent(controller)
    }
