Fixes to Newton method, which looks like it's working now.