adding update function