Changed the if/else to a switch statement.