Make template renderer more generic