refactor out root finding methods