Made a json format for diagram data and presented to the browser and reorganized things.