Used switch

a group of if statements were changed to use a switch statement which
seems more appropriate
Revert "Used switch"

This reverts commit 662a4cfc2c8c19b6e6c98260c92c1e02b322e9e5.
Used Switch

Switch statement was used instead of the group of if statements.