reorder and add trace log