simplify the clustering query