refactored sign up and login