improving caching when loading files.  and adding more unit tests