Add tests for JSON, clean up exceptions.
Comments.