add code for clustering