Fully working non-linear squares. Added versions that iterate through different perturbations to find out how robust the algorithm is.