Updated the diagram generation