Code for the trienode. Has not been tested yet, waiting upon Larry.