Simplified tab switching code