dynamically generating the templates