added function to calculate cross correlation function and test