Made changes to run the code by changing switches to if-else