Refactoring to use new data model