Code now works to correctly compute the autocorrelation for a changing lag number