tried to implement reorder function