Implemented constrained loop in kmeans splitting