Login process refactor