Started updating stats code to use JSON rather than simple HTML insertion.