Changed else-less ifs to whens