the clustering pipeline