Added code for writing csv files with numbers of clusters.