document sort helpers
change order of trace items to avoid creation of a tuple in the sort
function