added code for the switches