templating functional