some improvements to authentication template