separate out path-finding from actually refactoring, in the hope of parallelizing the latter