changed ifs to switches