broke login up into more discrete parts