generalized constructor in cross correlation
merged two versions