moved QueryDistribution to util