Added an updating function.