drafted kmeans algorithm