refactor sign in