Added functions to update the UI when values are changed.