Refactor ui.