Replaced code simulating JSON to new JSON implementation from koohar.