Finished update function