Finished refactoring login flow, prepared to rewrite login