first version of kmeans clustering