Updated the code for the diagrams