move rex seq regrouping to its own function
regroup rex alternatives as well