Replaced applicable if statements with switch statements