Adding templating code