Changed the Clustering code.