... (autocorrelation and a few helper functions)