refactoring data and UI