kmeans method updated