updates with 3a (k-means algorithm)
tweaks to k-means