Perhaps optimize.use_switch?