findtext proc exists for this operation.
use the global list of dirs.
Merge pull request #2352 from eswordthecat/patch-12

Some code improvements.