Minor clean up for im.switch_state