     
     var checkingForPendingConnections = false
     
-    var checkingForContacts = false
-    
     var currentSegmentedControl = "pending"
 
     override func viewDidLoad() {

        switch networkSegmentedControl.selectedSegmentIndex {
            case 0:
                currentSegmentedControl = "pending"
//                self.checkingForContacts = false
                clearUsersArrayAndReloadTableView()
                checkForPendingConnections()
                friendsTableView.tableHeaderView = resultSearchController.searchBar

                        }
                    }
                }
                
                // Sort Contacts by GivenName
                self.contacts.sortInPlace({ (contact1, contact2) -> Bool in
                    return contact1["givenName"] < contact2["givenName"]
                })
            }
        }
        catch{
