clean version for computeCorrelation