Working login, refactor into class