refactoring for new auth