Fix TextLoader class, and refactoring