Refactored auth