created a ternary for the same calculation