flipped a conditional to avoid an extra level of nesting.