testing sorting, think i may need to write my own sort so line order is
nto changed in the log
Fixed line order sort issue by adding line numbers in the lists
would like to refactor the filewriting defs