Cleaning up the login code