Added code to switch between tabs.