Added the templates function