finished simple version of kmeans