Some refactoring to support the KMeansConfigurationWithCentroids.