refactor sign in to method