added a template manager
added functions for the template manager