minor refactor to login