working on trinary
completed trinary