Added code to sort file output.