finalized with ternary