finished update function