Improving save and update function templates