sped up cross correlation calculation - still not functional