switched some ifs to switches