more refactoring and adding of login interface