Add k-means and spectra saving