refactoring and UI