changed x ifs to switch