Improved client authentication

Improved client authentication.