slight refactor on login