simplify ternary