Made modeSwitch function for togglebuttons