working on kmeans function