added validation for ternary