Reordered macro replacement