Store a cache of input descriptor lookups
Fix some bugs in unittests
Refactor verification of input file and implement caching