Complete rehaul of NR solver