refactor link_switch