working version. about to fix input & spectral clustering