Changed the authentication logic to actually work.