Factor out sortableTabs to make it useful elsewhere