No longer crashes and now outputs to the two files, but the percentages are all wrong and all scores say "infinity".