Changing update function to accept an array