implement templating