Re-facted login module.
Re-facted the login module.