added reorder function