reorder loop