Changed to organize data by kind first rather than case first, to simplify analysis. Also added functions to support distance corr CLS