reordering d helper