Refactor txt file reading to not manually handle whitespace