Added (theoretical) support for switching modes.