Fixed up a decently-working kmeans algorithm.