adding cross-correlation in js.function untested.