refactored sign_in script