Removed duplication in the different flavors of ifs