         
         // Sign in with a users email and password through Firebase
         if let email = emailField.text, let password = passwordField.text {
-            FIRAuth.auth()?.signIn(withEmail: password, password: email, completion: { (user, error) in
+            FIRAuth.auth()?.signIn(withEmail: email, password: password, completion: { (user, error) in
                 if error == nil {
-                    print("User authenticated with email")
+                    print("User authenticated with email 1")
                     if let user = user {
                         self.completeSignIn(id: user.uid)
                     }
                 } else {
                     FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: { (user, error) in
                         if error != nil {
-                            print("Unable to authenticate with Firebase using email")
+                            print("Unable to authenticate with Firebase using email 2")
                         } else {
                             print("Successfully authenticated with Firebase")
+                            if let user = user {
+                                self.completeSignIn(id: user.uid)
+                            }
                         }
                     })
                 }

    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    override func viewDidAppear(_ animated: Bool) {
        
        // Check if there is a UID, then perform segue
        if let _ = KeychainWrapper.standard.string(forKey: gKeyUID) {
            performSegue(withIdentifier: "goToFeed", sender: nil)
        }
    }

    }
}

extension UIViewController
{
    func hideKeyboard()
    {
        let tap: UITapGestureRecognizer = UITapGestureRecognizer(
            target: self,
            action: #selector(UIViewController.dismissKeyboard))
        
        view.addGestureRecognizer(tap)
    }
    
    func dismissKeyboard()
    {
        view.endEditing(true)
    }
}

