refactor to use username for login