refactored login form