added xcorr function