Rewrote JSON implementation.