Swap the if() in the state flag test to make it more readable.