Add authentication and fix templates