implement reordering