more refactoring in login feature