Login refactoring.