added template support