refactored data view logic