Refactored loading of text files.