Refactored data querying.