refactoring switch tab commands