switch context is now a function