Use ternary to simplify flow.