Added switch and associated code