refactor login startup