Final version for computeSingleCOrrelation