refactor the trace and make its toString nicer