This two ifs could be made into one. :-)