Add the switch functionality