more refactoring to move to DataRepository
more fixes