Reworked the authentication system