edit and add template functionality added