Working on the update function