refactor Login process