factorize kMeanGrp