Update to the k-means algorithm