Refactored AuthHelper