changes to the update function