 
     func loadGists(urlToLoad : String?)
     {
+        self.isLoading = true;
         GitHubAPIManager.sharedInstance.getPublicGists(pageToLoad: urlToLoad) { (result, nextPage) in
             self.nextPageURLString = nextPage
+            self.isLoading = false
             
             guard result.error == nil else
             {

    override func viewWillAppear(_ animated: Bool) {
        self.clearsSelectionOnViewWillAppear = self.splitViewController!.isCollapsed
        super.viewWillAppear(animated)
        //loadGists()
        GitHubAPIManager.sharedInstance.getStarredGistWithBasicAuth()
    }

    override func didReceiveMemoryWarning() {

        else {
            cell.imageView?.image = nil
        }
        
        let rowsToLoadFromBotton = 5;
        let rowsLoaded = gists.count
        if let nextPage = nextPageURLString {
            if (!isLoading && (indexPath.row >= (rowsLoaded - rowsToLoadFromBotton))) {
                self.loadGists(urlToLoad: nextPage)
            }
        }
        return cell
    }

