optimized reordering