Refactoring the login module.