merging update function