recursive templating