WIP: generic adhoc querying