change format from if to switch