Improve switch_pane