Some refactoring in UI.