Added templating code