Fixed up the output so it is sorted and tested