Totally rewritten find_root