Clustering algorithm almost fully functional