Added grade ternary to code.