Moved the template rendering to an external class