Refactored/tidied things. CachedFileReader is broken, and now causes the program to hang