clean up and moving out root finding to separate routine inside whamp