refactor: report trace-tree lazily and use less auxiliary vars