         tableView.alwaysBounceVertical = false
         
         self.refreshControl = refreshControl
+    }
+    
+    override func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        if !scrollingLocked && scrollView.contentOffset.y < -40 {
+            // when pulling down trigger refresh earlier
+            if !refreshControl!.isRefreshing {
+                refreshControl!.beginRefreshing()
+                refresh()
+            }
+        } else if (scrollView.contentOffset.y >= 0) {
+            // prevent bounce up
+            scrollView.setContentOffset(CGPoint(x: scrollView.contentOffset.x, y: 0), animated: false)
+        }
+    }
+    
+    override func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) {
+        scrollingLocked = true
+    }
+    
+    override func didRotate(from fromInterfaceOrientation: UIInterfaceOrientation) {
+        scrollingLocked = false
     }
     
     func setModule(module: MapModule?) {

        refreshControl?.endRefreshing()
        setControls(hidden: false)
        tableView.contentOffset.y = 0
    }
}


    
    fileprivate weak var module: MapModule?
    
    private var scrollingLocked: Bool = true
    
    override func viewWillAppear(_ animated: Bool) {
        let refreshControl = UIRefreshControl()
        refreshControl.addTarget(self, action: #selector(self.refresh), for: .valueChanged)
