refactoring the login method out into the new class