moved template processing to template_engine