Created a SwitchGroup() function