Added a copy of the working switch.cpp file