Refactored for multiple Query Providers