refactoring login module