refactoring for data storage how the Domain class works