Refactored authentication system to be stateless.