     }
 
     public func clearData() {
+        mainCellCount = 0
+        tableView.reloadData()
+        updateFooter(true)
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(0.01 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) {
-            self.tableView.scrollToRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 0), atScrollPosition: .Top, animated: false)
+            if self.tableView(self.tableView, numberOfRowsInSection: 1) > 0  { // Prevent error "row (0) beyond bounds (0) for section (0)."
+                self.tableView.scrollToRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 1), atScrollPosition: .Top, animated: false)
+            }
         }
-        mainCellCount = 0
-        hidesFooter = false
     }
 
     // MARK: - Private


    // MARK: - TableViewDataSource

    override public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return allCellCount
    }

    public override func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {


    // MARK: - TableViewDelegate

    public override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
        cellHeights[indexPath] = cell.frame.height

        if isFooter(indexPath) {
            let currentCount = mainCellCount
            let currentAllCellCount = allCellCount

            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
                self.fetchReadCountClosure(currentCount: currentCount, completion: { [weak self] readCount, hasNext in

                    dispatch_async(dispatch_get_main_queue()) {
                        self?.mainCellCount = currentCount + readCount
                        UIView.setAnimationsEnabled(false)
                        self?.tableView.insertRowsAtIndexPaths(
                            Array(currentAllCellCount..<currentAllCellCount + readCount).map{ NSIndexPath(forRow: $0, inSection: 0) },
                            withRowAnimation: .None)
                        UIView.setAnimationsEnabled(true)

                        if !hasNext {
                            self?.updateFooter(false)
                        } else {
                            // To call willDisplayCell delegate to read cells
                            self?.updateFooter(true)
                        }
                    }
                })
            }
