Convert if blocks to a switch block.

ACE-48