         var usrEntered = txtUsername.text
         var pwdEntered = txtPassword.text
         
-        func userLogIn(){
+        func userLogIn() {
             PFUser.logInWithUsernameInBackground(usrEntered, password:pwdEntered) {
                 (user: PFUser!, error: NSError!) -> Void in
                 if user != nil {
                     self.txtIncompleteFieldsMessage.text = "Log in successful."
-                    self.dismissViewControllerAnimated(true, completion: nil)
+                    self.navigationController?.popToRootViewControllerAnimated(true)
                 } else {
                     self.txtIncompleteFieldsMessage.text = "Log in failed. Please try again."
                 }

        
    }
    
}



    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        NSNotificationCenter.defaultCenter().postNotificationName("loggedIn", object: nil)
        
        var currentUser = PFUser.currentUser()
        if currentUser != nil {
