mescc: Refactor switch.