CRA-635: Implementation of Spearman correlation and fixed some bugs.