Refactored out crawlDir function.