refactored tab activate functions