Convert big if-else to switch.