Minor refactorings following the last commit for KMeans

Refactored the common function into a Functions util class. 
Comment can be expanded perhaps, but also not refer to 4-elements