refactored methods on auth and updated test cases