Combined two if statements into one