Revert "Replaced if statements with switch statement."

This reverts commit d52cf6e806016c650f5613708243a7508acf1414.