Simplified two if statements