Minor refactorings following the last commit for KMeans