Implemented a switch instead of cascading if statements