Finishes authentication refactoring