added basic template support