refactored log in