Change ifs to switch