Kinda working. Changing the autocorrelation unit to not run if the sample is not valid to stop the random frequency spikes which seem to be due to the algorithm not converging.