Move tab switching action to its own function. Update visible tabs on load based on session