exposed coreQuery.  slight reordering for readability