change the kmeans function