Created updateUI function.