Improve authentication method