added kmeans
corrected bugs in the clustering step