working with template defs