complete update function