     }
     
     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)
         }
     }
     

    var mailboxDigipostAddress: String = "";
    var receiptsUri: String = "";
    var numberOfReceiptsChangedUponLastUpdate: Bool! = true;
    
    
    override func viewDidLoad() {

        let scrollOffset = scrollView.contentOffset.y;
        
        if(self.numberOfReceiptsChangedUponLastUpdate &&
                !self.currentlyFetchingReceiptsData &&
                scrollOffset + scrollViewHeight >= 0.8 * scrollViewContentSizeHeight) {
            print("Debug: scrollViewDidScroll update") // <- DEBUG
            self.fetchReceiptsFromAPI()
        }
    }
    
    func setupTableViewStyling() {
