Modify the update function