Improvements to EPUB reader and moved and renamed collapseFilePath function

Sorry for the fragility of this part of the program.

There is more description of why it happened in the final commit.