How to change the tabs order programmatically?

How to change the tabs order programmatically?

Hi, I've asked this question before but to no avail. Hopefully, I'll be luckier this time

I have a set of tabs with one containing static content, and the others being loaded via Ajax. The static tab has a widget that allows the reordering (sorting) of the dynamic tabs. This is done by first removing all the dynamic tabs using the remove method, and then re-adding them with the add method.

Previous to 1.8 this worked perfectly, now additional space is added to the top of the static content for each dynamic tab that is moved around. Interestingly, clicking on one of the dynamic tabs and then back to the static tab fixes the display issue. I've replicated this in both Firefox and IE.

The only solution I've found is to select the tab at index 0 and then use a setTimeout to select the static tab again. This solution isn't very nice, and does produce some flicker even though the timeout is set at 1 millisecond.

My questions are:
1) Is there a better way of reordering the tabs?
2) Has anyone encountered this and found a fix?
3) Shouldn't this functionality be included in the tabs API?

Thanks