login process refactored