Made a small addition to the update function