edit template functionality finished