Replaced if/else's with switch statement