Refactoring so that Tabs determines Tab index from DOM