Refactored to use template_render