Removed a bunch of else if statements with switch case