Fix calls to file()

Closes #43
Use a pre-order search

Should help with the conditional check.
Merge pull request #63 from brettcannon/fix_file

Fix calls to file()