switch if/else logic