change if to switch clause