Correct reordering and grouping of BGPs.