Changes to have fixed access to templates and minor fixes