Corrected first draft of midpoint rooting method