Added an update function