new and updated kmeans algorithm