Adding thread ID to trace lines and cleaning up their formatting.