Ok, so I have to implement a more accurate derivative, change the error metric for LMA to the root mean square in the paper, find amplitudes using least squares linear fitting, and re implement arch detection to use first derivatives.