     */
 
     func tableView(tableView: UITableView, targetIndexPathForMoveFromRowAtIndexPath sourceIndexPath: NSIndexPath, toProposedIndexPath proposedDestinationIndexPath: NSIndexPath) -> NSIndexPath {
-        let sourceSection = self.sectionAtIndexPath(sourceIndexPath)
-        let item = self.itemAtIndexPath(sourceIndexPath)
-        if let moveHandler = item.moveHandler {
+        if let sourceSection = self.sectionAtIndexPath(sourceIndexPath), let item = self.itemAtIndexPath(sourceIndexPath), let moveHandler = item.moveHandler {
             let allowed = moveHandler(section: sourceSection, item: item, tableView: tableView, sourceIndexPath: sourceIndexPath, destinationIndexPath: proposedDestinationIndexPath)
             if !allowed {
                 return sourceIndexPath
             }
         }
-        
         return proposedDestinationIndexPath
     }
 
     func tableView(tableView: UITableView, indentationLevelForRowAtIndexPath indexPath: NSIndexPath) -> Int {
-        return self.itemAtIndexPath(indexPath).indentationLevel
+        if let item = self.itemAtIndexPath(indexPath) {
+            return item.indentationLevel
+        }
+        return 0
     }
     
     func tableView(tableView: UITableView, shouldShowMenuForRowAtIndexPath indexPath: NSIndexPath) -> Bool {
-        let item = self.itemAtIndexPath(indexPath)
-        return item.copyHandler != nil || item.pasteHandler != nil || item.cutHandler != nil
-        
+        if let item = self.itemAtIndexPath(indexPath) {
+            return item.copyHandler != nil || item.pasteHandler != nil || item.cutHandler != nil
+        }
+        return false
     }
     
     func tableView(tableView: UITableView, canPerformAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject) -> Bool {
-        let item = self.itemAtIndexPath(indexPath)
-        
-        if item.copyHandler != nil && action == Selector("copy:") {
-            return true
-        }
-        
-        if item.pasteHandler != nil && action == Selector("paste:") {
-            return true
-        }
-        
-        if item.cutHandler != nil && action == Selector("cut:") {
-            return true
-        }
-        
+        if let item = self.itemAtIndexPath(indexPath) {
+            if item.copyHandler != nil && action == Selector("copy:") {
+                return true
+            }
+            if item.pasteHandler != nil && action == Selector("paste:") {
+                return true
+            }
+            if item.cutHandler != nil && action == Selector("cut:") {
+                return true
+            }
+        }
         return false
     }
     
     func tableView(tableView: UITableView, performAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject!) {
-        let item = self.itemAtIndexPath(indexPath)
-        let section = self.sectionAtIndexPath(indexPath)
-        if let copyHandler = item.copyHandler where action == Selector("copy:") {
-            copyHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
-        }
-        if let pasteHandler = item.pasteHandler where action == Selector("paste:") {
-            pasteHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
-        }
-        if let cutHandler = item.cutHandler where action == Selector("cut:") {
-            cutHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
+        if let item = self.itemAtIndexPath(indexPath), let section = self.sectionAtIndexPath(indexPath) {
+            if let copyHandler = item.copyHandler where action == Selector("copy:") {
+                copyHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
+            }
+            if let pasteHandler = item.pasteHandler where action == Selector("paste:") {
+                pasteHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
+            }
+            if let cutHandler = item.cutHandler where action == Selector("cut:") {
+                cutHandler(section: section, item: item, tableView: tableView, indexPath: indexPath)
+            }
         }
     }
 }
    
    
    func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return self.sectionAtIndexPath(NSIndexPath(forRow: 0, inSection: section)).headerTitle
    }
    
    func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? {
        return self.sectionAtIndexPath(NSIndexPath(forRow: 0, inSection: section)).footerTitle
    }
    
    func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        
        if let dataSource = self.dataSource {
            if indexPath.section < dataSource.sections.count {
                let section = self.sectionAtIndexPath(indexPath)
                if (indexPath.row < section.items.count) {
                    let item = self.itemAtIndexPath(indexPath)
                    return item.editingStyle != .None || item.moveHandler != nil
                }
            }
        }
        return false
    }
    
    func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
        return self.itemAtIndexPath(indexPath).moveHandler != nil
    }
    
    func sectionIndexTitlesForTableView(tableView: UITableView) -> [AnyObject]! {

    // Data manipulation - reorder / moving support
    
    func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath) {
        if let sourceSection = self.sectionAtIndexPath(sourceIndexPath), let item = self.itemAtIndexPath(sourceIndexPath), let destinationSection = self.sectionAtIndexPath(destinationIndexPath) {
            sourceSection.items.removeAtIndex(sourceIndexPath.row)
            destinationSection.items.insert(item, atIndex: destinationIndexPath.row)
            
            if let moveCompletionHandler = item.moveCompletionHandler {
                moveCompletionHandler(section: destinationSection, item: item, tableView: tableView, sourceIndexPath: sourceIndexPath, destinationIndexPath: destinationIndexPath)
            }
        }
    }

