new version with cooler query support