This is a marginally more efficient way of processing the results, copying everything into arrays which can be looped over, and using the same routines for both single and multiple iterations.  This reduces by half the amount of code needed to produce the summary file, and I think it makes it a tiny bit easier to add new results to the outputs if we need to.  This is not finished but I'm committing the changes made so far to avoid any possibility of losing them.  The linelist files look good for single and multiple iterations; the summary files still need some sorting.