Cleaned up a fair bit of duplication.
Switched to caching filenames rather than File objects to cut down on File creation during lookup.