part 2 of performance improvements

Now, checking for cached files before all other things.