Add back toJSON shim. Add more shim comments.

Resolves #360