refactored tab creation