Minor refactoring of stats file output.