Tidy up tab switching