thanks for looking that over!
that line is supposed to take the current error from the last calculation and make it the previous error for the next calculation.
i fixed some mistakes in the code i posted here, but i still have the currerr=preverr issue.