added newtonf_tol and thresholdw_tol as runtime parameters