improve row reordering