cleanup and update the UI