CHANGE write to file using sortedList (see issue #37)

To ensure serialibility of this method