Use switch instead of if/else plus code rewrite.