refactor the UI