move from if to switch