better xcorr scripting