refactoring data model code out of ui widget