move switch into controller