                 
                 return
             }
+            
+            if self.previousSearchResults == nil {
+                
+                self.tableView.reloadData()
+            }
+            else {
+                
+                // update table view with nice animations...
+                
+                self.tableView.beginUpdates()
+                
+                let results = self.searchResultsController!.searchResults
+                
+                let previousSearchResultsArray = self.previousSearchResults! as NSArray
+                
+                for (index, searchResult) in enumerate(results) {
+                    
+                    // already present
+                    if previousSearchResultsArray.containsObject(searchResult) {
+                        
+                        let previousIndex = previousSearchResultsArray.indexOfObject(searchResult) as Int
+                        
+                        // move cell
+                        if index != previousIndex {
+                            
+                            self.tableView.deleteRowsAtIndexPaths([NSIndexPath(forRow: Int(previousIndex), inSection: 0)], withRowAnimation: .Automatic)
+                            
+                            self.tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: Int(index), inSection: 0)], withRowAnimation: .Automatic)
+                        }
+                            
+                            // update cell
+                        else {
+                            
+                            let indexPath = NSIndexPath(forRow: Int(index), inSection: 0)
+                            
+                            if let cell = self.tableView.cellForRowAtIndexPath(indexPath) {
+                                
+                                self.configureCell(cell, atIndexPath: indexPath)
+                            }
+                        }
+                    }
+                        
+                        // new managed object
+                    else {
+                        
+                        self.tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .Automatic)
+                    }
+                }
+                
+                self.tableView.endUpdates()
+            }
+            
+            self.previousSearchResults = nil
         }
     }
     

        }
        
        self.datedRefreshed = NSDate()
        
        self.searchResultsController!.performSearch(sender)
    }

    
    private var searchResultsController: SearchResultsController?
    
    private var previousSearchResults: [NSManagedObject]?
    
    // MARK: - Initialization
    
    public override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        let error = self.searchResultsController?.loadCache()
        
        assert(error == nil, "Could not load cache. (\(error!.localizedDescription))")
    }
    
    public override func viewWillAppear(animated: Bool) {
