switch_logic