change templeate logic