added logic so that autocorrelation of 0 is no longer a max value