auth refactored