Minor changes from code review.
Added some sorting and formatting to the report which is now written to a file.
Toy implementation of keeping track of traces already seen (using a text file).