Can these two if statements be combined into one?