Added SortLines() function