Refactoring of the Login process.