ui: code refactoring