login small refactoring