Refactoring find functions for terminator problem.