Improved Sorting of tabs

Changed the way tabs are sorted to make more sense