term_finder refactoring