These two if statements could be combined