adding template processing function.