Reorder function.