sign in refactoring