         updateActivityIndicatorWithWebView(webView)
         updateProgressViewWithWebView(webView)
         if !loading {
-            refreshControl?.endRefreshing()
+            if refreshControl?.refreshing ?? false {
+                refreshControl?.endRefreshing()
+            }
             if let _ = webView.URL {
                 hasLoadedContent = true
             }

    public func setupRefreshControl() {
        let newRefreshControl = UIRefreshControl()
        newRefreshControl.attributedTitle = NSAttributedString(string: "")
        newRefreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
        webView.scrollView.insertSubview(newRefreshControl, atIndex: 0)
        refreshControl = newRefreshControl
    }

        if webView.loading {
            if let refreshControl = refreshControl where !refreshControl.refreshing {
                activityIndicator.startAnimating()
                UIApplication.sharedApplication().networkActivityIndicatorVisible = true
            }
        } else {
            activityIndicator.stopAnimating()
            UIApplication.sharedApplication().networkActivityIndicatorVisible = false
        }
    }
    /**
