encode: Add `useNamedReferences` option, disabled by default

Closes #6.