changed ifs to a switch