User auth refactored