Refactoring and Ui design