More work on the {cgjs} stuff.
Adds a few more utility functions.