add infrastructure for switching modes