Oauth template fix and clean up