added the update function