extract template renderer into own class