refactoring for logging in and initialization