     }
     
     func deselectAllRows(){
-        for selectedIndexPath in self.tableView.indexPathsForSelectedRows! {  // as we only operate with one section
+        if(self.tableView.indexPathsForSelectedRows == nil){
+            return
+        }
+        
+        for selectedIndexPath in self.tableView.indexPathsForSelectedRows! {
             self.tableView.cellForRowAtIndexPath(selectedIndexPath)?.selectionStyle = UITableViewCellSelectionStyle.Default
             self.tableView.deselectRowAtIndexPath(selectedIndexPath, animated: false)
+        }
+    }
+    
+    func getIndexPathsForSelectedCells() -> [NSIndexPath] {
+        if(self.tableView.indexPathsForSelectedRows == nil){
+            return []
+        }
+        
+        // for some peculiar reason, simply using the index paths retrieved by "(..).indexPathsForSelectedRows" returns an additional index path
+        var indexPaths = self.tableView.indexPathsForSelectedRows!
+        indexPaths.removeLast()
+        return indexPaths
+    }
+    
+    func selectCellsFor(indexPaths: [NSIndexPath]) {
+        for indexPathForSelectedRow in indexPaths {
+            self.tableView.selectRowAtIndexPath(indexPathForSelectedRow, animated: false, scrollPosition: UITableViewScrollPosition.None)
         }
     }
     

    
    func pullToRefresh() {
        print("Pull to refresh")
        fetchReceiptsFromAPI()
        self.numberOfReceiptsChangedUponLastUpdate = true
    }
    
    func fetchReceiptsFromAPI() {
        print("Attempting to fetch data...")
        
        var fetchedReceipts: [POSReceipt] = []
        
        // completion methods
        func setFetchedObjects(APICallResult: Dictionary<String,AnyObject>){
            self.receiptsTableViewDataSource.receipts = parseReceiptsFrom(APICallResult["receipt"]!) // set in success method as it's called asynchronously
            print("Successfully fetched receipts.")
            self.tableView.reloadData()
            self.updateNavbar()
            self.updateToolbarButtonItems()
            self.refreshControl.endRefreshing()
        }
        func f(e: APIError){ print(e.altertMessage) }
                
        let parameters : Dictionary<String,String> = {
            ["skip": "2", "take": "2"];
        }()
        
        APIClient.sharedClient.updateReceiptsInMailboxWithDigipostAddress(self.mailboxDigipostAddress, uri: self.receiptsUri, parameters: parameters, success: setFetchedObjects, failure: f)
    }
    
    func parseReceiptsFrom(APICallReceiptResult: AnyObject) -> Array<POSReceipt>{
        var receiptList:Array<POSReceipt> = []
        
        let managedObjectContext = POSModelManager.sharedManager().managedObjectContext

        for index in 0...(APICallReceiptResult.count-1 /* 0-indexed */) {
            var receiptAttributes: Dictionary<String, AnyObject> = Dictionary<String,AnyObject>()
            
            for receiptFieldKey in APICallReceiptResult[index].allKeys {

    var mailboxDigipostAddress: String = "";
    var receiptsUri: String = "";
    var numberOfReceiptsChangedUponLastUpdate: Bool! = true;
    var currentlyFetchingReceiptsData: Bool! = false // mutex-like variable for avoiding duplicate calls upon continuous scrollViewDidScroll-method-invocation
    
    
    override func viewDidLoad() {
