add ternary operators to short the condition to one line