update function of UI and button