     }
     
     @IBAction func logoutUser(_ sender: Any) {
+        ActivityIndicator.sharedInstance().startActivityIndicator(self)
         FirebaseHelper.sharedInstance().signOutUser { (error) in
-            if error == nil {
-                self.dismiss(animated: true, completion: nil)
-                let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginSignupVC")
-                self.present(vc!, animated: true, completion: nil)
-            } else {
-                self.showAlert("Error", error!.localizedDescription)
+            performUIUpdatesOnMain {
+                ActivityIndicator.sharedInstance().stopActivityIndicator(self)
+                if error == nil {
+                    self.dismiss(animated: true, completion: nil)
+                    let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginSignupVC")
+                    self.present(vc!, animated: true, completion: nil)
+                } else {
+                    self.showAlert("Error", error!.localizedDescription)
+                }
             }
         }
     }

        return cell
    }
    
    // MARK: - Post Data Source
    
    func newPostAdded(newPost: Post) {
        posts.append(newPost)
        tableView.reloadData()
    }

        
        tableView.reloadData()
        FirebaseHelper.sharedInstance().addObserverForNewPosts()
        ActivityIndicator.sharedInstance().startActivityIndicator(self)
    }
    
    override func viewWillDisappear(_ animated: Bool) {
