Make the login process more granular with defers