update the UI function