Fixes in algorithm for neg errors + first version of both errors
algorithm