reorder function definition