Added a variable update function.