Improved cookie authentication.