clean up computeCentroids