condensed if else into ternary