Cleaning up some of the tab generation code.