Add in switching function