trimmed whitespace in the right place;
departed from respecting the format used by the test code, and moving in a different direction (be sure to retire the test code);
reworked the extraction code to populate arrays and then write those arrays whole to the files (rather than writing to the files as we go);
more ToDo items;