added template pattern