dynamically generating templates