Adding update function