diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..62c893550adb53d3a8fc29a1584ff831cb829062
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea/
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a87a04dfab16e35811de9435de3daeea82d594d4..b2a7cf622eaabdd02bd281368f7731bb237922e4 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,24 +5,22 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="d3e74292-1e1a-4cba-81b3-9c9d67f586ca" name="Default" comment="">
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.pdf" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/.gitignore" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF.tex" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF_example.py" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/XDSM.py" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/__init__.py" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_border.tex" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_styles.tex" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.aux" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.log" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.tex" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/.gitignore" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/Example/IDF.py" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/ReadMe.md" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/XDSM/XDSM.py" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/XDSM/__init__.py" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/XDSM/diagram_border.tex" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/XDSM/diagram_styles.tex" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/testXDSM.pdf" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.pdf" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/MDOproblem.py" afterPath="$PROJECT_DIR$/pyKADMOS/MDOproblem.py" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/MDOstatic.py" afterPath="$PROJECT_DIR$/pyKADMOS/MDOstatic.py" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/MDOvisualization.py" afterPath="$PROJECT_DIR$/pyKADMOS/MDOvisualization.py" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/Example/IDF.py" afterPath="$PROJECT_DIR$/pyKADMOS/PyXDSM/Example/IDF.py" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/PyXDSM/XDSM/XDSM.py" afterPath="$PROJECT_DIR$/pyKADMOS/PyXDSM/XDSM/XDSM.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_styles.tex" afterPath="$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_styles.tex" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/sellarProblem.py" afterPath="$PROJECT_DIR$/pyKADMOS/sellarProblem.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/testXDSM.log" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.log" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pyKADMOS/testXDSM.tex" afterPath="$PROJECT_DIR$/pyKADMOS/testXDSM.tex" />
     </list>
     <ignored path="KADMOS.iws" />
     <ignored path=".idea/workspace.xml" />
@@ -48,7 +46,7 @@
     <SUITE FILE_PATH="coverage/KADMOS$Doc_MDOproblem_class.coverage" NAME="doc MDOproblem class Coverage Results" MODIFIED="1465810428149" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
     <SUITE FILE_PATH="coverage/KADMOS$CPACSdummyProblem.coverage" NAME="CPACSdummyProblem Coverage Results" MODIFIED="1465915292787" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pyKADMOS" />
     <SUITE FILE_PATH="coverage/KADMOS$bigMathProblem.coverage" NAME="bigMathProblem Coverage Results" MODIFIED="1463418247627" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pyKADMOS" />
-    <SUITE FILE_PATH="coverage/KADMOS$sellarProblem.coverage" NAME="sellarProblem Coverage Results" MODIFIED="1466114812664" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pyKADMOS" />
+    <SUITE FILE_PATH="coverage/KADMOS$sellarProblem.coverage" NAME="sellarProblem Coverage Results" MODIFIED="1466430091776" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pyKADMOS" />
     <SUITE FILE_PATH="coverage/KADMOS$test_pymetis.coverage" NAME="test_pymetis Coverage Results" MODIFIED="1463842497510" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pyKADMOS" />
   </component>
   <component name="CreatePatchCommitExecutor">
@@ -63,8 +61,8 @@
       <file leaf-file-name="MDOproblem.py" pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOproblem.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="-1290">
-              <caret line="497" column="23" selection-start-line="497" selection-start-column="8" selection-end-line="497" selection-end-column="23" />
+            <state relative-caret-position="249">
+              <caret line="717" column="36" selection-start-line="717" selection-start-column="36" selection-end-line="717" selection-end-column="36" />
               <folding>
                 <element signature="e#0#11#0" expanded="true" />
               </folding>
@@ -72,21 +70,11 @@
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="IDF_example.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF_example.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="447">
-              <caret line="41" column="62" selection-start-line="40" selection-start-column="4" selection-end-line="41" selection-end-column="62" />
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="MDOvisualization.py" pinned="false" current-in-tab="true">
+      <file leaf-file-name="MDOvisualization.py" pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOvisualization.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="387">
-              <caret line="277" column="0" selection-start-line="277" selection-start-column="0" selection-end-line="277" selection-end-column="0" />
+            <state relative-caret-position="849">
+              <caret line="356" column="61" selection-start-line="356" selection-start-column="61" selection-end-line="356" selection-end-column="61" />
               <folding>
                 <element signature="e#0#31#0" expanded="true" />
               </folding>
@@ -94,21 +82,23 @@
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="XDSM.py" pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/XDSM.py">
+      <file leaf-file-name="MDOstatic.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOstatic.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="885">
-              <caret line="59" column="8" selection-start-line="59" selection-start-column="8" selection-end-line="59" selection-end-column="8" />
-              <folding />
+            <state relative-caret-position="894">
+              <caret line="464" column="62" selection-start-line="464" selection-start-column="62" selection-end-line="464" selection-end-column="62" />
+              <folding>
+                <element signature="e#39#52#0" expanded="true" />
+              </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="sellarProblem.py" pinned="false" current-in-tab="false">
+      <file leaf-file-name="sellarProblem.py" pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/pyKADMOS/sellarProblem.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="585">
-              <caret line="100" column="21" selection-start-line="100" selection-start-column="21" selection-end-line="100" selection-end-column="21" />
+            <state relative-caret-position="840">
+              <caret line="56" column="38" selection-start-line="56" selection-start-column="38" selection-end-line="56" selection-end-column="38" />
               <folding>
                 <element signature="e#0#13#0" expanded="true" />
               </folding>
@@ -131,9 +121,6 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/CON_FD-info.json" />
-        <option value="$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/CON_FD-input.xml" />
-        <option value="$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/OBJ-info.json" />
         <option value="$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/OBJ-output.xml" />
         <option value="$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/CON_FD-output.xml" />
         <option value="$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/EMISSION-input.xml" />
@@ -178,10 +165,13 @@
         <option value="$PROJECT_DIR$/pyKADMOS/XDSM-master/XDSM/XDSM.py" />
         <option value="$PROJECT_DIR$/pyKADMOS/XDSM-master/XDSM/IDF_example.py" />
         <option value="$PROJECT_DIR$/pyKADMOS/XDSM/IDF_example.py" />
-        <option value="$PROJECT_DIR$/pyKADMOS/MDOstatic.py" />
+        <option value="$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF_example.py" />
+        <option value="$PROJECT_DIR$/pyKADMOS/testXDSM.tex" />
+        <option value="$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_styles.tex" />
+        <option value="$PROJECT_DIR$/pyKADMOS/MDOvisualization.py" />
         <option value="$PROJECT_DIR$/pyKADMOS/MDOproblem.py" />
         <option value="$PROJECT_DIR$/pyKADMOS/sellarProblem.py" />
-        <option value="$PROJECT_DIR$/pyKADMOS/MDOvisualization.py" />
+        <option value="$PROJECT_DIR$/pyKADMOS/MDOstatic.py" />
       </list>
     </option>
   </component>
@@ -192,8 +182,8 @@
     <sorting>DEFINITION_ORDER</sorting>
   </component>
   <component name="ProjectFrameBounds">
-    <option name="width" value="1280" />
-    <option name="height" value="800" />
+    <option name="width" value="1920" />
+    <option name="height" value="1080" />
   </component>
   <component name="ProjectInspectionProfilesVisibleTreeState">
     <entry key="Project Default">
@@ -239,10 +229,6 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
-      <pane id="ProjectPane">
-        <subPane />
-      </pane>
-      <pane id="Scratches" />
       <pane id="Scope">
         <subPane subId="Project Files">
           <PATH>
@@ -282,13 +268,17 @@
               <option name="myItemId" value="" />
               <option name="myItemType" value="" />
             </PATH_ELEMENT>
-            <PATH_ELEMENT USER_OBJECT="PyXDSM">
+            <PATH_ELEMENT USER_OBJECT="XDSM_writer">
               <option name="myItemId" value="" />
               <option name="myItemType" value="" />
             </PATH_ELEMENT>
           </PATH>
         </subPane>
       </pane>
+      <pane id="ProjectPane">
+        <subPane />
+      </pane>
+      <pane id="Scratches" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -730,16 +720,16 @@
     </todo-panel>
   </component>
   <component name="ToolWindowManager">
-    <frame x="0" y="0" width="1280" height="800" extended-state="0" />
+    <frame x="0" y="0" width="1920" height="1080" extended-state="0" />
     <editor active="true" />
     <layout>
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1558966" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.14323749" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32876712" sideWeight="0.49676898" order="6" side_tool="false" content_ui="tabs" />
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4328524" sideWeight="0.4394184" order="7" side_tool="true" content_ui="tabs" />
       <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32328767" sideWeight="0.4628433" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32240438" sideWeight="0.4628433" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32876712" sideWeight="0.49676898" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="true" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43150684" sideWeight="0.56058156" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="true" anchor="bottom" auto_hide="true" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.31620553" sideWeight="0.56058156" order="2" side_tool="false" content_ui="tabs" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.13844515" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
       <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32608697" sideWeight="0.49192247" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@@ -791,20 +781,6 @@
     <watches-manager />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/CON_EM-output.xml">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="75">
-          <caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/CON_EM-input.xml">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="0">
-          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/pyKADMOS/KB_CPACS_dummy/CON_EM-info.json">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="60">
@@ -1039,79 +1015,87 @@
     <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM-master/XDSM/__init__.py" />
     <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM-master/XDSM/IDF_example.py" />
     <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM-master/XDSM/XDSM.py" />
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/PyXDSM/ReadMe.md">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/PyXDSM/ReadMe.md" />
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_border.tex">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="0">
           <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_border.tex">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF.log">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="0">
           <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_styles.tex">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF_example.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="165">
-          <caret line="11" column="18" selection-start-line="11" selection-start-column="18" selection-end-line="11" selection-end-column="18" />
+        <state relative-caret-position="405">
+          <caret line="27" column="16" selection-start-line="27" selection-start-column="16" selection-end-line="27" selection-end-column="16" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/XDSM.py">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/testXDSM.tex">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="885">
-          <caret line="59" column="8" selection-start-line="59" selection-start-column="8" selection-end-line="59" selection-end-column="8" />
-          <folding />
+        <state relative-caret-position="212">
+          <caret line="152" column="20" selection-start-line="152" selection-start-column="20" selection-end-line="152" selection-end-column="20" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/sellarProblem.py">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/XDSM.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="585">
-          <caret line="100" column="21" selection-start-line="100" selection-start-column="21" selection-end-line="100" selection-end-column="21" />
-          <folding>
-            <element signature="e#0#13#0" expanded="true" />
-          </folding>
+        <state relative-caret-position="909">
+          <caret line="281" column="34" selection-start-line="281" selection-start-column="34" selection-end-line="281" selection-end-column="34" />
+          <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/IDF_example.py">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/XDSM_writer/diagram_styles.tex">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="447">
-          <caret line="41" column="62" selection-start-line="40" selection-start-column="4" selection-end-line="41" selection-end-column="62" />
+        <state relative-caret-position="300">
+          <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
           <folding />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOstatic.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="2427">
-          <caret line="250" column="9" selection-start-line="250" selection-start-column="9" selection-end-line="250" selection-end-column="9" />
+        <state relative-caret-position="894">
+          <caret line="464" column="62" selection-start-line="464" selection-start-column="62" selection-end-line="464" selection-end-column="62" />
           <folding>
             <element signature="e#39#52#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOvisualization.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="849">
+          <caret line="356" column="61" selection-start-line="356" selection-start-column="61" selection-end-line="356" selection-end-column="61" />
+          <folding>
+            <element signature="e#0#31#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOproblem.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-1290">
-          <caret line="497" column="23" selection-start-line="497" selection-start-column="8" selection-end-line="497" selection-end-column="23" />
+        <state relative-caret-position="249">
+          <caret line="717" column="36" selection-start-line="717" selection-start-column="36" selection-end-line="717" selection-end-column="36" />
           <folding>
             <element signature="e#0#11#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pyKADMOS/MDOvisualization.py">
+    <entry file="file://$PROJECT_DIR$/pyKADMOS/sellarProblem.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="387">
-          <caret line="277" column="0" selection-start-line="277" selection-start-column="0" selection-end-line="277" selection-end-column="0" />
+        <state relative-caret-position="840">
+          <caret line="56" column="38" selection-start-line="56" selection-start-column="38" selection-end-line="56" selection-end-column="38" />
           <folding>
-            <element signature="e#0#31#0" expanded="true" />
+            <element signature="e#0#13#0" expanded="true" />
           </folding>
         </state>
       </provider>
diff --git a/pyKADMOS/MDOproblem.py b/pyKADMOS/MDOproblem.py
index a73396df4552dbc135437b7afef9a0eba1ffc43e..b03bb04061a24331f5ec2c5f73ddcbb03b72aa12 100644
--- a/pyKADMOS/MDOproblem.py
+++ b/pyKADMOS/MDOproblem.py
@@ -508,29 +508,27 @@ class MDOproblem:
         :return: dictionary with the PSG process flow and the PSG data flow
         :rtype: dict
         """
-
-        PSG = dict.fromkeys(['data flow', 'process flow'])
-
-        #------------------#
-        # PSG process flow #
-        #------------------#
-
+        # ------------------#
+        #  FPG+input check  #
+        # ------------------#
         # Find all function nodes
-        function_nodes = set(find_all_nodes(FPG, attr_cond=['category','==','function']))
+        function_nodes = set(find_all_nodes(FPG, attr_cond=['category', '==', 'function']))
 
         # Select design variables, parameters, constraint and objective functions
         des_var_nodes = find_all_nodes(FPG, attr_cond=['PSG role', '==', 'design variable'])
         assert len(des_var_nodes) > 0, "No design variables are specified. Use the 'PSG role' attribute for this."
-        parameter_nodes = list(set(find_all_nodes(FPG, category='variable', subcategory='all inputs')).\
-            difference(set(des_var_nodes)))
+        parameter_nodes = list(set(find_all_nodes(FPG, category='variable', subcategory='all inputs')). \
+                               difference(set(des_var_nodes)))
         constraint_nodes = find_all_nodes(FPG, attr_cond=['PSG role', '==', 'constraint'])
-        assert len(constraint_nodes) > 0,"No constraint variables are specified. Use the 'PSG role' attribute for this."
+        assert len(
+            constraint_nodes) > 0, "No constraint variables are specified. Use the 'PSG role' attribute for this."
 
         objective_node = find_all_nodes(FPG, attr_cond=['PSG role', '==', 'objective'])
         assert len(objective_node) == 1, "%d design variables are specified. Only one objective node is allowed." \
                                          "Use the 'PSG role' attribute for this." % len(objective_node)
+        optimizer_nodes_in = objective_node + constraint_nodes
         constraint_functions = list()
-        for idx,node in enumerate(objective_node+constraint_nodes):
+        for idx, node in enumerate(objective_node + constraint_nodes):
             assert FPG.node[node]['indegree'] == 1, "Invalid indegree of %d, while it should be 1." \
                                                     % FPG.node[node]['indegree']
             assert FPG.node[node]['outdegree'] == 0, "Invalid outdegree of %d, while it should be 0." \
@@ -539,12 +537,8 @@ class MDOproblem:
                 objective_function = FPG.in_edges(node)[0][0]
             else:
                 constraint_functions.append(FPG.in_edges(node)[0][0])
+        optimizer_functions = [objective_function] + constraint_functions
 
-        print function_nodes
-        print objective_function
-        print constraint_functions
-        print des_var_nodes
-        print parameter_nodes
 
         # Select analysis order functions
         for node in analysis_order:
@@ -552,17 +546,22 @@ class MDOproblem:
                 "One of the names ('%s') in the analysis_order input is invalid." % node
 
         # Remove the objective function and constraint functions from the set
-        MDA_analysis_nodes = function_nodes.difference(set([objective_function]+constraint_functions))
+        MDA_analysis_nodes = function_nodes.difference(set(optimizer_functions))
 
         # Check if any functions are left between analysis nodes and analysis order?
         assert len(MDA_analysis_nodes.difference(set(analysis_order))) == 0, \
             "There are undefined functions present in the FPG, namely %s! These should be added to the analysis order" \
             " or become objective/constraints functions." % MDA_analysis_nodes.difference(set(analysis_order))
 
+        #------------------#
+        # PSG process flow #
+        #------------------#
         # Set up PSG process graph
         PSG_process = nx.DiGraph()
         PSG_process.graph['architecture'] = 'MDF'
-        PSG_process.graph['number_of_diagonal_blocks'] = 2 + len(analysis_order) + 1 + len(constraint_functions)
+        PSG_process.graph['number_of_diagonal_blocks'] = 3 + len(analysis_order) + 1 + len(constraint_functions)
+        PSG_process.graph['number_of_MDA_analyses'] = len(analysis_order)
+        PSG_process.graph['number_of_OPT_functions'] = 1 + len(constraint_functions)
 
         # Add MDA block
         PSG_process.add_node('MDA',
@@ -571,18 +570,21 @@ class MDOproblem:
                              shape='8',
                              label='MDA',
                              level=None,
-                             diagonal_position=1)
+                             diagonal_position=2,
+                             process_step=2,
+                             converger_step=3+len(analysis_order))
 
         # Connect MDA + analyses
-        from_node = 'MDA'
         if MDA_type == 'Gauss-Seidel':
+            from_node = 'MDA'
             for idx, node in enumerate(analysis_order):
-                PSG_process.add_node(node,FPG.node[node],diagonal_position=2+idx)
+                PSG_process.add_node(node,FPG.node[node],diagonal_position=3+idx)
                 PSG_process.node[node]['category'] = 'architecture element'
                 PSG_process.node[node]['subcategory'] = 'MDA analysis'
-                PSG_process.add_edge(from_node, node)
+                PSG_process.node[node]['process_step'] = idx+3
+                PSG_process.add_edge(from_node, node, process_step=idx+3)
                 from_node = node
-            PSG_process.add_edge(from_node,'MDA')
+            PSG_process.add_edge(from_node,'MDA',process_step=idx+4)
 
         # Add optimization block
         PSG_process.add_node('Optimizer',
@@ -591,105 +593,173 @@ class MDOproblem:
                              shape='8',
                              label='OPT',
                              level=None,
-                             diagonal_position=0)
+                             diagonal_position=1,
+                             process_step=1,
+                             converger_step=3+len(analysis_order)+2)
 
         # Connect optimization with MDA
-        PSG_process.add_edge('Optimizer', 'MDA')
+        PSG_process.add_edge('Optimizer', 'MDA', process_step=2)
 
         # Connect MDA with functions and functions with optimizer
-        for idx, node in enumerate(constraint_functions+[objective_function]):
-            PSG_process.add_node(node, FPG.node[node],diagonal_position=2+len(analysis_order)+idx)
+        for idx, node in enumerate(optimizer_functions):
+            PSG_process.add_node(node, FPG.node[node],diagonal_position=3+len(analysis_order)+idx)
             PSG_process.node[node]['category'] = 'architecture element'
             PSG_process.node[node]['subcategory'] = 'optimizer function'
-            PSG_process.add_edge('MDA',node)
-            PSG_process.add_edge(node,'Optimizer')
+            PSG_process.node[node]['process_step'] = 4+len(analysis_order)
+            PSG_process.add_edge('MDA',node, process_step=4+len(analysis_order))
+            PSG_process.add_edge(node,'Optimizer', process_step=5+len(analysis_order))
 
-        # Add input variables x^(0)
-        for node in des_var_nodes:
-            new_node = '/PSG/design_variables/initial_guesses/' + FPG.node[node]['label'] + '^0'
-            PSG_process.add_node(new_node,
-                                 category='architecture element',
-                                 subcategory='initial guess design variable',
-                                 shape='o',
-                                 label=FPG.node[node]['label']+'(0)',
-                                 level=4)
-            PSG_process.add_edge(new_node,'Optimizer')
-
-        # Add output variables x^*
-        for node in des_var_nodes:
-            new_node = '/PSG/design_variables/final_value/' + FPG.node[node]['label'] + '^*'
-            PSG_process.add_node(new_node,
-                                 category='architecture element',
-                                 subcategory='final design variable',
-                                 shape='o',
-                                 label=FPG.node[node]['label']+'(0)',
-                                 level=4)
-            PSG_process.add_edge('Optimizer',new_node)
-
-        print ''
-        print 'NODES'
-        for node, data in PSG_process.nodes_iter(data=True):
-            print node
-            if 'diagonal_position' in data:
-                print data['diagonal_position']
-
-        print ''
-        print 'EDGES'
-        for edge in PSG_process.edges_iter(data=True):
-            print edge
-
-        PSG['process flow'] = PSG_process
+        # Add Initiator block
+        PSG_process.add_node('Initiator',
+                             category='architecture element',
+                             subcategory='initiator',
+                             shape='8',
+                             label='INI',
+                             level=None,
+                             diagonal_position=0,
+                             process_step = 0,
+                             converger_step = 6+len(constraint_functions))
+        # Connect initiator with optimizer
+        PSG_process.add_edge('Initiator', 'Optimizer', process_step=1)
+        PSG_process.add_edge('Optimizer', 'Initiator', process_step=6+len(constraint_functions))
 
         # ------------------#
         #   PSG data flow   #
         # ------------------#
-
-        # Find all function nodes
-
-
-        # Select constraint and objective functions
-
-
-        # Select analysis order functions
-
-
-        # Check if any functions are left?
-
+        # Set up PSG process graph
+        PSG_data = FPG.copy()
+        PSG_data.graph['architecture'] = 'MDF'
+        PSG_data.graph['number_of_diagonal_blocks'] = 2 + len(analysis_order) + 1 + len(constraint_functions)
+        PSG_data.graph['number_of_MDA_analyses'] = len(analysis_order)
+        PSG_data.graph['number_of_OPT_functions'] = 1 + len(constraint_functions)
 
         # Add MDA block
+        PSG_data.add_node('MDA',
+                          category='architecture element',
+                          subcategory='MDA',
+                          shape='8',
+                          label='MDA',
+                          level=None,
+                          diagonal_position=2)
+
+        # Add Initiator block
+        PSG_data.add_node('Initiator',
+                             category='architecture element',
+                             subcategory='initiator',
+                             shape='8',
+                             label='INI',
+                             level=None,
+                             diagonal_position=0)
 
-
-        # Adjust data flow according to MDA (add variable copies and rearrange edges)
-
-
-        # Add design variable inputs for MDA analyses
-
-
-        # Add starting coupling variables values
-
-
+        # Loop over MDA analyses, add copy variables and adjust edges
+        if MDA_type == 'Gauss-Seidel':
+            for idx, analysis in enumerate(analysis_order):
+                PSG_data.node[analysis]['category'] = 'architecture element'
+                PSG_data.node[analysis]['subcategory'] = 'MDA analysis'
+                PSG_data.node[analysis]['diagonal_position'] = 3+idx
+
+                # Check incoming edges
+                in_edges = FPG.in_edges(analysis)
+                for edge in in_edges:
+                    # Check if edge is an input
+                    in_node = edge[0]
+                    if not set([in_node]).intersection(set(find_all_nodes(FPG,subcategory='all inputs'))):
+                        if set([in_node]).intersection(set(find_all_nodes(FPG, subcategory='all problematic nodes'))):
+                            raise IOError("A problematic node is still present in the FPG.")
+                        elif set([in_node]).intersection(set(find_all_nodes(FPG, subcategory='all couplings'))):
+                            # Check if the node is coupled to a future analysis
+                            coupled_functions = map((lambda x: x[0]), FPG.in_edges(in_node))
+                            if set(coupled_functions).intersection(set(analysis_order[idx:])):
+                                # Add variable copy node between MDA and function
+                                new_node = '/PSG/coupling_variables/MDA/' + FPG.node[in_node]['label'] + str('^c')
+                                PSG_data.add_node(new_node,
+                                                  category='architecture element',
+                                                  subcategory='MDA coupling variable',
+                                                  shape='o',
+                                                  label=FPG.node[in_node]['label'] + '^c',
+                                                  level=3)
+                                PSG_data.add_edge('MDA',new_node)
+                                PSG_data.add_edge(new_node, analysis)
+                                PSG_data.remove_edge(in_node,edge[1])
+                                # Add edge between the coupling variable and the MDA
+                                PSG_data.add_edge(in_node,'MDA')
+                                # Add initial guess MDA coupling variable
+                                new_node = '/PSG/coupling_variables/MDA/' + FPG.node[in_node]['label'] + str('^{c0}')
+                                PSG_data.add_node(new_node,
+                                                  category='architecture element',
+                                                  subcategory='initial guess MDA coupling variable',
+                                                  shape='o',
+                                                  label=FPG.node[in_node]['label'] + '^{c0}',
+                                                  level=3)
+                                PSG_data.add_edge(new_node, 'MDA')
+                                PSG_data.add_edge('Initiator', new_node)
+                # Check outcoming edges
+                out_edges = FPG.out_edges(analysis)
+                for edge in out_edges:
+                    # Check if edge is a coupling variable
+                    out_node = edge[1]
+                    if set([out_node]).intersection(set(find_all_nodes(FPG, subcategory='all couplings'))):
+                        # Add final coupling variable node and connect to analysis function and initiator
+                        new_node = '/PSG/coupling_variables/MDA/' + FPG.node[out_node]['label'] + str('^*')
+                        PSG_data.add_node(new_node,
+                                          category='architecture element',
+                                          subcategory='final MDA coupling variable',
+                                          shape='o',
+                                          label=FPG.node[out_node]['label'] + '^*',
+                                          level=3)
+                        PSG_data.add_edge(analysis,new_node)
+                        PSG_data.add_edge(new_node,'Initiator')
+
+        # Recategorize design variables and connect to optimizer and initiator
         # Add optimization block
+        PSG_data.add_node('Optimizer',
+                          category='architecture element',
+                          subcategory='optimizer',
+                          shape='8',
+                          label='OPT',
+                          level=None,
+                          diagonal_position=1)
 
+        for node in des_var_nodes:
+            # Connect design variables to optimizer
+            PSG_data.add_edge('Optimizer',node)
 
-        # Connect optimization block to design variables
-
-
-        # Add design variable starting values to opt block
-
-
-        # Add final design variable outputs to opt block
-
-
-        # Add functions plus variable nodes
-
-
-        # Connect function outputs to the optimizer
-
-
-        # Add final coupling variable output y^*
-
-
-        return PSG
+            # Add input variables x^(0) and connect to optimizer
+            new_node = '/PSG/design_variables/initial_guesses/' + FPG.node[node]['label'] + '^0'
+            PSG_data.add_node(new_node,
+                              category='architecture element',
+                              subcategory='initial guess design variable',
+                              shape='o',
+                              label=FPG.node[node]['label'] + '^0',
+                              level=3)
+            PSG_data.add_edge(new_node, 'Optimizer')
+            PSG_data.add_edge('Initiator', new_node)
+
+            # Add output variables x^* and connect to optimizer and initiator
+            new_node = '/PSG/design_variables/final_value/' + FPG.node[node]['label'] + '^*'
+            PSG_data.add_node(new_node,
+                              category='architecture element',
+                              subcategory='final design variable',
+                              shape='o',
+                              label=FPG.node[node]['label'] + '^*',
+                              level=3)
+            PSG_data.add_edge('Optimizer', new_node)
+            PSG_data.add_edge(new_node, 'Initiator')
+
+        # Add parameters and connect with INI function
+        for node in parameter_nodes:
+            # Connect parameter node to initiator
+            PSG_data.add_edge('Initiator', node)
+
+        # Adjust and connect optimizer functions output to optimizer
+        for idx, node in enumerate(optimizer_functions):
+            PSG_data.node[node]['diagonal_position']= 3 + len(analysis_order) + idx
+            PSG_data.node[node]['category'] = 'architecture element'
+            PSG_data.node[node]['subcategory'] = 'optimizer function'
+        for node in optimizer_nodes_in:
+            PSG_data.add_edge(node,'Optimizer')
+
+        return {'data flow':PSG_data,'process flow':PSG_process}
 
 
 if __name__ == '__main__':
diff --git a/pyKADMOS/MDOproblem.pyc b/pyKADMOS/MDOproblem.pyc
index 46762ba3067c8c092b49955331961a15966634e1..3f6db9505cc38010256b6a7d24f669db8dc84b65 100644
Binary files a/pyKADMOS/MDOproblem.pyc and b/pyKADMOS/MDOproblem.pyc differ
diff --git a/pyKADMOS/MDOstatic.py b/pyKADMOS/MDOstatic.py
index 4c81b1c01824cb146141e3cc638a7a2a27121f05..ad818b8e270c09f500dfbce5f4d0e7c406d919be 100644
--- a/pyKADMOS/MDOstatic.py
+++ b/pyKADMOS/MDOstatic.py
@@ -168,12 +168,16 @@ def get_categorized_nodes(graph, print_in_log=True):
                             'inputless': [],
                             'outputless': [],
                             'complete': []},
-              'architecture element': {'optimizer': [],
-                                        'MDA': [],
-                                        'optimizer function': [],
-                                        'MDA analysis': [],
-                                        'initial guess design variable': [],
-                                        'final design variable': []}}
+              'architecture element': {'initiator': [],
+                                       'optimizer': [],
+                                       'MDA': [],
+                                       'optimizer function': [],
+                                       'MDA analysis': [],
+                                       'initial guess design variable': [],
+                                       'final design variable': [],
+                                       'MDA coupling variable': [],
+                                       'initial guess MDA coupling variable': [],
+                                       'final MDA coupling variable': []}}
 
     for node, data in graph.nodes_iter(data=True):
         for key1 in result:
@@ -229,6 +233,8 @@ def find_all_nodes(graph, category='all', subcategory='all', attr_cond=None, pri
         * all outputs
         * all couplings
         * all problematic nodes
+        * all PSG blocks
+        * all design variables
         * hole
         * supplied input
         * supplied shared input
@@ -248,7 +254,15 @@ def find_all_nodes(graph, category='all', subcategory='all', attr_cond=None, pri
         * inputless
         * outputless
         * complete
-        * TODO ADD MORE FROM ARCHITECTURE ELEMENTS
+        * optimizer
+        * MDA
+        * optimizer function
+        * MDA analysis
+        * initial guess design variable
+        * final design variable
+        * MDA coupling variable
+        * initial guess MDA coupling variable
+        * final MDA coupling variable
 
     Example usage:
     Just get all nodes of a graph in a list:
@@ -266,12 +280,15 @@ def find_all_nodes(graph, category='all', subcategory='all', attr_cond=None, pri
     """
     # Assert inputs
     possible_categories = ['all','variable','variable group','function','architecture element']
-    possible_subcategories = ['all','all inputs','all outputs','all couplings','all problematic nodes','hole',
+    possible_subcategories = ['all','all inputs','all outputs','all couplings','all problematic nodes',
+                              'all PSG blocks','all design variables', 'hole',
                               'supplied input','supplied shared input','output','collision','coupling',
                               'shared coupling','collided coupling','collided shared coupling','hole group',
                               'supplied input group','supplied shared input group','output group','coupling group',
-                              'shared coupling group','hole','inputless','outputless','complete']
-                             # TODO: add architecture elements subcategories
+                              'shared coupling group','hole','inputless','outputless','complete','initiator',
+                              'optimizer','MDA','optimizer function','MDA analysis','initial guess design variable',
+                              'final design variable','MDA coupling variable','initial guess MDA coupling variable',
+                              'final MDA coupling variable']
     assert isinstance(graph,type(nx.DiGraph()))
     assert isinstance(category, str)
     assert isinstance(subcategory, str)
@@ -307,10 +324,15 @@ def find_all_nodes(graph, category='all', subcategory='all', attr_cond=None, pri
         subcategory = ['output', 'collision', 'output group']
     elif subcategory == 'all couplings':
         subcategory = ['coupling', 'shared coupling', 'collided coupling', 'collided shared coupling',
-                       'coupling group', 'shared coupling group']
+                       'coupling group', 'shared coupling group','MDA coupling variable',
+                       'initial guess MDA coupling variable','final MDA coupling variable']
     elif subcategory == 'all problematic nodes':
         subcategory = ['hole', 'collision', 'collided coupling', 'collided shared coupling', 'hole group',
                        'inputless', 'outputless']
+    elif subcategory == 'all PSG blocks':
+        subcategory = ['initiator','optimizer','MDA','optimizer function','MDA analysis']
+    elif subcategory == 'all design variables':
+        subcategory = ['initial guess design variable', 'final design variable']
 
     if not isinstance(category, list) and category != 'all':
         category = [category]
@@ -440,4 +462,4 @@ def get_adjacency_matrix(graph, print_in_log=True):
         pp.pprint(nx.convert.to_dict_of_dicts(graph, edge_data=1))
 
     return {'dict of dicts': nx.convert.to_dict_of_dicts(graph, edge_data=1),
-            'SciPy sparse matrix': nx.adjacency_matrix(graph)}
+            'SciPy sparse matrix': nx.adjacency_matrix(graph)}
\ No newline at end of file
diff --git a/pyKADMOS/MDOstatic.pyc b/pyKADMOS/MDOstatic.pyc
index 437d5764514717bc8003e5c7232c80651a3634a6..865790597cf43130b5ba16e11a08bc8247cb121d 100644
Binary files a/pyKADMOS/MDOstatic.pyc and b/pyKADMOS/MDOstatic.pyc differ
diff --git a/pyKADMOS/MDOvisualization.py b/pyKADMOS/MDOvisualization.py
index b9ae12057e3f73424711fb43b0e8ac78c972778e..c861f3e3a66ab794e24afcf1ee59b01db0e14f0a 100644
--- a/pyKADMOS/MDOvisualization.py
+++ b/pyKADMOS/MDOvisualization.py
@@ -272,58 +272,89 @@ def create_XDSM(PSG, filename):
     PSG_process = PSG['process flow']
     PSG_data = PSG['data flow']
 
-    # add diagonal components in order from up to down
-    # all 'EMPTY' heading name component is used for Input and output, the component will not be shown.
-    ad('EMPTY', 'Analysis', '')
-
-    print ''
-    print 'NODE CHECK'
-    for node,data in PSG_process.nodes_iter(data=True):
-        print node
-        print data
-    loc_idx1 = 0
-    loc_idx2 = 0
+    # Add diagonal components in order from up to down
+    # Add analysis blocks
     for idx in range(0,PSG_process.graph['number_of_diagonal_blocks']):
-        print idx
         node_list = find_all_nodes(PSG_process, attr_cond=['diagonal_position','==',idx])
-        print node_list
         assert len(node_list)==1, "Somehow, a unique diagonal position '%d' could not be found in the PSG process" \
                                   " graph." % idx
         node = node_list[0]
-        if PSG_process.node[node]['subcategory'] == 'optimizer':
-            node_name = 'opt'
+        if PSG_process.node[node]['subcategory'] == 'initiator':
+            node_style = 'Initiator'
+            node_text = '$'+str(PSG_process.node[node]['process_step'])+','+\
+                        str(PSG_process.node[node]['converger_step'])+'$:\\'+PSG_process.node[node]['label']
+        elif PSG_process.node[node]['subcategory'] == 'optimizer':
             node_style = 'Optimization'
-            node_text = r'Optimization'
+            node_text = '$'+str(PSG_process.node[node]['process_step'])+','+\
+                        str(PSG_process.node[node]['converger_step'])+'\to'+\
+                        str(PSG_process.node[node]['process_step']+1)+'$:\\'+PSG_process.node[node]['label']
         elif PSG_process.node[node]['subcategory'] == 'MDA':
-            node_name = 'mda'
             node_style = 'MDA'
-            node_text = r'MDA'
+            node_text = '$'+str(PSG_process.node[node]['process_step'])+','+\
+                        str(PSG_process.node[node]['converger_step'])+'\to'+\
+                        str(PSG_process.node[node]['process_step']+1)+'$:\\'+PSG_process.node[node]['label']
         elif PSG_process.node[node]['subcategory'] == 'MDA analysis':
-            node_name = 'ana'+str(loc_idx1)
             node_style = 'Analysis'
-            node_text = PSG_process.node[node]['label'].encode('string-escape')
-            loc_idx1 += 1
+            node_text = '$' + str(PSG_process.node[node]['process_step']) + '$:\\' + PSG_process.node[node]['label']
         elif PSG_process.node[node]['subcategory'] == 'optimizer function':
-            node_name = 'fun'+str(loc_idx2)
             node_style = 'Function'
-            node_text = PSG_process.node[node]['label'].encode('string-escape')
-            loc_idx2 += 1
+            node_text =  '$' + str(PSG_process.node[node]['process_step']) + '$:\\' + PSG_process.node[node]['label']
         else:
             raise AssertionError('PSG node category not as expected.')
-        ad(node_name, node_style, ('$0,3\to 1$:\\'+node_text).encode('string-escape'))
-
-    dsm.addChain(['opt', 'mda', 'ana0', 'ana1', 'mda', 'fun0', 'opt']) # TODO, make generic based on PSG
-    dsm.addChain(['mda', 'fun1', 'opt']) # TODO, make generic based on PSG
-    dsm.addChain(['mda', 'fun2', 'opt']) # TODO, make generic based on PSG
-
-    # TODO, add correct process numbering based on PSG
-
-    # TODO, add final design variables and initial guess design variables (including chain)
-
-    # TODO: add data flow!
+        ad(node, node_style, node_text.encode('string-escape'))
+
+    # Add process chain lines to the XDSM
+    for edge in PSG_process.edges_iter():
+        # Add line between two blocks that are on the diagonal
+        if len(set(edge).intersection(set(find_all_nodes(PSG_process,category='architecture element',
+                                                     subcategory='all PSG blocks')))) == 2:
+            dsm.addChain([edge[0], edge[1]])
+
+    # Determine connected diagonal blocks and add data dependency
+    for idx1 in range(0, PSG_process.graph['number_of_diagonal_blocks']-1):
+        for idx2 in range(idx1+1, PSG_process.graph['number_of_diagonal_blocks']):
+            # Find first diagonal node
+            node_list = find_all_nodes(PSG_data, attr_cond=['diagonal_position', '==', idx1])
+            assert len(node_list) == 1, "Somehow, a unique diagonal position '%d' could not be found in the PSG process" \
+                                        " graph." % idx1
+            node1 = node_list[0]
+            # Find second diagonal node
+            node_list = find_all_nodes(PSG_data, attr_cond=['diagonal_position', '==', idx2])
+            assert len(node_list) == 1, "Somehow, a unique diagonal position '%d' could not be found in the PSG process" \
+                                        " graph." % idx2
+            node2 = node_list[0]
+            node1_out = map((lambda x: x[1]),PSG_data.out_edges(node1))
+            node1_in = map((lambda x: x[0]),PSG_data.in_edges(node1))
+            node2_out = map((lambda x: x[1]),PSG_data.out_edges(node2))
+            node2_in = map((lambda x: x[0]),PSG_data.in_edges(node2))
+
+            # Determine intersection between outputs and inputs
+            node_set_upp = set(node1_out).intersection(set(node2_in))
+            node_set_low = set(node1_in).intersection(set(node2_out))
+
+            # Determine data type for visualization
+            if node1 == 'Initiator':
+                data_type = 'DataIO'
+            else:
+                data_type = 'DataInter'
+
+
+            # Upper triangle of XDSM
+            if node_set_upp:
+                str_num = str(PSG_process.node[node2]['process_step']) + ': '
+                str_upp = ', '.join(map(str, map((lambda x: '$' + PSG_data.node[x]['label'] + '$'), node_set_upp)))
+                co(node2, node1, data_type, (str_num+str_upp).encode('string-escape'))
+
+            # Lower triangle of XDSM
+            if node_set_low:
+                # Check existence of process edge and add edge number if it exists
+                str_num = (str(PSG_process.node[node1]['converger_step']) + ': ') \
+                    if ('converger_step' in PSG_process.node[node1]) \
+                    else (str(PSG_process.node[node1]['process_step']) + ': ')
+                str_low = ', '.join(map(str, map((lambda x: '$' + PSG_data.node[x]['label'] + '$'), node_set_low)))
+                co(node1, node2, data_type, (str_num+str_low).encode('string-escape'))
 
     # TODO: update documentation and possible node categories
-    # TODO: reconsider automatic copying of node attributes in PSG creation
 
     # output tex file and compile it
     dsm.write(filename.encode('string-escape'), compilepdf=True)
\ No newline at end of file
diff --git a/pyKADMOS/MDOvisualization.pyc b/pyKADMOS/MDOvisualization.pyc
index 8eb607ac9a09a0ca752c45a767ba2203a4164bb5..69b73546f01a20ce557179d7f02ff3dcb5ed2ead 100644
Binary files a/pyKADMOS/MDOvisualization.pyc and b/pyKADMOS/MDOvisualization.pyc differ
diff --git a/pyKADMOS/PyXDSM/.gitignore b/pyKADMOS/PyXDSM/.gitignore
deleted file mode 100755
index 08f41ee6a3a283ecf321e261d63a417cb5d4efee..0000000000000000000000000000000000000000
--- a/pyKADMOS/PyXDSM/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.*~
-*.aux
-*.log
-*.pdf
-*.swp
-.rope*/
-
diff --git a/pyKADMOS/PyXDSM/Example/IDF.py b/pyKADMOS/PyXDSM/Example/IDF.py
deleted file mode 100755
index bca44b3edc9897d33309f3be5527440c2169f500..0000000000000000000000000000000000000000
--- a/pyKADMOS/PyXDSM/Example/IDF.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python2
-#-*- coding:utf-8 -*-
-# speicify XDSM_writer code path
-import sys
-sys.path.append('../XDSM_writer')
-
-from XDSM_writer import XDSM
-
-
-def make_IDF_XDSM():
-
-    dsm = XDSM()
-    ad = lambda *args, **kargs: dsm.addComp(*args, **kargs)
-    co = lambda *args, **kargs: dsm.addDep(*args, **kargs)
-
-    # add diagnol (Component) in order from up to down
-
-    ad('EMPTY', 'Analysis', '')
-    #all 'EMPTY' heading name component is used for Input and output,
-    # the component will not be shown,
-    # here used for upper input and left output
-    ad('opt', 'Optimization', r'$0,3\to 1$:\\Optimization')
-    ad('ana', 'Analysis, stack', r'$1$\\Analysis $i$')
-    ad('fun', 'Function', r'$2$\\Functions')
-
-    #add dependency variables, here order free
-    co('opt', 'EMPTY', 'DataInter',
-       r'$\mathbf{x}^{(0)}, \hat{\mathbf{y}}^{(0)}$')
-    co('EMPTY', 'opt', 'DataInter',
-       r'$x^*$')
-    co('ana', 'opt', 'DataInter',
-       r'$1:\mathbf{x}_0, \mathbf{x}_i, \hat{\mathbf{y}}_{j\neq i}$')
-    co('EMPTY', 'ana', 'DataInter,stack',
-       r'$\mathbf{y}_i^*$')
-    co('fun', 'opt', 'DataInter',
-       r'$2:\mathbf{x}, \hat{\mathbf{y}}$')
-    co('fun', 'ana', 'DataInter, stack',
-       r'$2:\mathbf{y}_i$')
-    co('opt', 'fun', 'DataInter',
-       '$3:f_0,\mathbf{c}, \mathbf{c}^c$')
-
-    # component name from start to the end in turn
-    dsm.addChain([
-        'opt-EMPTY', 'opt', 'ana', 'fun', 'opt', 'EMPTY-opt'])
-    #the dependency node using "downstream_component-upstream_component"
-
-    # output tex file and compile it
-    dsm.write(r'IDF.pdf', compilepdf=True)
-
-if __name__ == '__main__':
-    make_IDF_XDSM()
-
-
-
diff --git a/pyKADMOS/PyXDSM/ReadMe.md b/pyKADMOS/PyXDSM/ReadMe.md
deleted file mode 100755
index 6a3a42b9435f308f832440de94d6090c0513d960..0000000000000000000000000000000000000000
--- a/pyKADMOS/PyXDSM/ReadMe.md
+++ /dev/null
@@ -1,43 +0,0 @@
-##Extended Design Structure Matrix (XDSM) 
-###python and Tex code of generation utitlity 
-
-#### Requirement:
-
-* Python 2.7.X
-* newest TexLive or other latex suite (need Xetex-relevant pacakges)
-
-
-##### Feature(Compared with original version):
-
-1. add input-ouput node generation()
-2. add chain line support(addChain method)
-3. Chinese support based on Xetex, (using XDSMCJK)
-
-Detals can be refered from the source code and example file.
-
-
-Any question contact:
-
-
-> greatcwmine AT gmail DOT com
-    
-
-----------
-This code is a modified version from 
-
-
->   http://mdolab.engin.umich.edu/content/xdsm-overview
-
-licensed by:
-> The XDSM LaTeX source and generator files are provided as-is and free of charge. Users are free to download, modify, and redistribute the software as they please, provided this notice remains. 
-
-
-> If you use the XDSM format for research, we ask that you cite the following journal publication in your work:
-
-
-> A. B. Lambe and J. R. R. A. Martins, “Extensions to the Design Structure Matrix for the Description of Multidisciplinary Design, Analysis, and Optimization Processes”, Structural and Multidisciplinary Optimization, vol. 46, no. 2, p. 273-284, 2012.
-
-
-
-Thank A. B. Lambe, J. R. R. A. Martins for developing and sharing
-
diff --git a/pyKADMOS/PyXDSM/XDSM/XDSM.py b/pyKADMOS/PyXDSM/XDSM/XDSM.py
deleted file mode 100755
index 9dd07765abf2bd09fefa25b047be27e6cdf6fef2..0000000000000000000000000000000000000000
--- a/pyKADMOS/PyXDSM/XDSM/XDSM.py
+++ /dev/null
@@ -1,283 +0,0 @@
-"""
-XDSM tex source writer utility. Three methods:
-1. addComp(name, style, string, stack=False)
-      name: [string] label of the component
-      style: [string] Tikz block style, defined in diagram_styles.tex
-      string: [string] name of the component that appears in the pdf
-      stack: [boolean] adds the stack option
-2. addDep(out, inp, style, string, stack=False)
-      out: [string] label of the component that depends on the variable
-      inp: [string] label of the component that computes the variable
-      style: [string] Tikz block style, defined in diagram_styles.tex
-      string: [string] name of the variable that appears in the pdf
-      stack: [boolean] adds the stack option
-3. write(filename, compilepdf=False)
-      filename: [string] write to filename+'.pdf'
-      compilepdf: [string] whether to run pdflatex on the tex file
-4. addChain( chain_node_list)
-    list the chain in consequence
-
-XDSMCJK
-    add Chinese supporting using xetex and xeCJK package
-    the interface is the same as XDSM
-    the  characters in latex file need using UTF-8 encoding
-    except ANSI characters
-
-Original author:
-    A.B.Labme lambe@utias.utoronto.ca
-Modified By:
-    David Chen greatcwmine@gmail.com
-
-"""
-
-
-class XDSM(object):
-
-    """ original XDSM_writer graphic class """
-
-    def __init__(self, xdsm_path=None):
-        """
-        xdsm_path : the XDSM_writer tex style file directory path,
-                default is path of the same folder of XDSM_writer.py """
-        self.inds = {}
-        self.comps = []
-        self.deps = []
-        self.chains = []
-
-        if xdsm_path:
-            self._xdsm_path = xdsm_path
-        else:
-            import os
-            self._xdsm_path = os.path.dirname(os.path.abspath(__file__))
-
-    def _is_empty_comp(self, name):
-        """ define empty node rule """
-        if name[:5] == 'EMPTY':
-            return True
-        else:
-            return False
-
-    def addComp(self, name, style, string, stack=False):
-        """ addComp(name, style, string, stack=False)
-            name: [string] label of the component
-                    using EMPTY heading keywort to specify EMPTY node
-                    (e.g. overall inputs and outpus)
-            style: [string] Tikz block style, defined in diagram_styles.tex
-            string: [string] name of the component that appears in the pdf
-            stack: [boolean] adds the stack option
-        """
-        self.inds[name] = len(self.comps)
-        self.comps.append([name, style, string, stack])
-
-    def addDep(self, out, inp, style, string, stack=False):
-        """ addDep(out, inp, style, string, stack=False)
-            out: [string] label of the component that depends on the variable
-            inp: [string] label of the component that computes the variable
-            style: [string] Tikz block style, defined in diagram_styles.tex
-            string: [string] name of the variable that appears in the pdf
-            stack: [boolean] adds the stack option
-        """
-
-        self.deps.append([out, inp, style, string, stack])
-
-    def addChain(self, chain_list):
-        """ set the process chain list """
-        if len(chain_list) < 2:
-            raise ValueError('the process chain has 2 elements at least')
-        self.chains.append(chain_list)
-
-    def getCmds(self):
-        """ generate the XDSM_writer matrix node"""
-        def write(i, j, name, style, string, stack):
-            M[i][j] = '    \\node'
-            M[i][j] += ' [' + style + (',stack]' if stack else ']')
-            M[i][j] += ' (' + name + ')'
-            M[i][j] += ' {' + string + '};'
-            M[i][j] += ' &\n' if j < n - 1 \
-                else (' \\\\\n    %Row ' + str(i+2) + '\n')
-
-        n = len(self.comps)
-
-        inds = self.inds
-
-        names = [[None for j in range(n)]
-                 for i in range(n)]
-
-        for name, style, string, stack in self.comps:
-            names[inds[name]][inds[name]] = name
-        for out, inp, style, string, stack in self.deps:
-            names[inds[inp]][inds[out]] = out+'-'+inp
-
-        M = [
-            [('    &\n' if j < n - 1 else '    \\\\\n') for j in range(n)]
-            for i in range(n)]
-        for name, style, string, stack in self.comps:
-            # skip EMPTY* component
-            if not self._is_empty_comp(name):
-                write(inds[name], inds[name], name, style, string, stack)
-
-        for out, inp, style, string, stack in self.deps:
-            write(inds[inp], inds[out], out+'-'+inp, style, string, stack)
-
-        H = ['' for i in range(n)]
-        for i in range(n):
-            minj = i
-            maxj = i
-            for out, inp, style, string, stack in self.deps:
-                j = inds[out]
-                if inds[inp] is i and not self._is_empty_comp(inp):
-                    minj = j if j < minj else minj
-                    maxj = j if j > maxj else maxj
-            if minj is not maxj:
-                H[i] = '   '
-                H[i] += ' (' + names[i][minj] + ')'
-                H[i] += ' edge [DataLine]'
-                H[i] += ' (' + names[i][maxj] + ')\n'
-
-        V = ['' for jj in range(n)]
-        for j in range(n):
-            mini = j
-            maxi = j
-            for out, inp, style, string, stack in self.deps:
-                i = inds[inp]
-                if inds[out] is j and not self._is_empty_comp(out):
-                    mini = i if i < mini else mini
-                    maxi = i if i > maxi else maxi
-            if mini is not maxi:
-                V[j] = '   '
-                V[j] += ' (' + names[mini][j] + ')'
-                V[j] += ' edge [DataLine]'
-                V[j] += ' (' + names[maxi][j] + ')\n'
-
-        return M, H, V
-
-    def _write_construction(self, fun_w):
-        """ write the XDSM_writer construction code
-        Args:
-            fun_w: closure function fun_w(string) to write string to stream
-        Return: None
-        """
-        n = len(self.comps)
-        M, H, V = self.getCmds()
-        w = lambda s: fun_w(s+'\n')
-        import os
-        xpath = self._xdsm_path.replace('\\', r'/')
-
-        w('\\usepackage{geometry}')
-        w('\\usepackage{amsfonts}')
-        w('\\usepackage{amsmath}')
-        w('\\usepackage{amssymb}')
-        w('\\usepackage{tikz}')
-        w('')
-        w('\\input{%s/diagram_border}' % xpath)
-        w('')
-        w('\\begin{document}')
-        w('')
-        w('\\input{%s/diagram_styles}' % xpath)
-        w('')
-        w('\\begin{tikzpicture}')
-        w('')
-
-        w('  \\matrix[MatrixSetup]')
-        w('  {')
-        w('    %Row 1')
-        for i in range(n):
-            for j in range(n):
-                fun_w(M[i][j])
-        w('  };')
-        w('')
-        # for the chain process
-        if self.chains:
-            w(r'   % XDSM_writer process chains ')
-            for i, chn in enumerate(self.chains):
-                w(r'   { [start chain=process]')
-                w(r'       \begin{pgfonlayer}{process}')
-                w(r'       \chainin (%s);' % chn[0])
-                last_node = chn[0]
-                for e in chn[1:]:
-                    if '-' in e or '-' in last_node:
-                        w(r'       \chainin (%s)    [join=by ProcessTip];' % e)
-                    else:
-                        w(r'       \chainin (%s)    [join=by ProcessHV];' % e)
-
-                    last_node = e
-                w(r'       \end{pgfonlayer}')
-                w(r'   }')
-                w('')
-
-        w('  \\begin{pgfonlayer}{data}')
-        w('    \\path')
-        w('    % Horizontal edges')
-        for i in range(n):
-            fun_w(H[i])
-        w('    % Vertical edges')
-        for j in range(n):
-            fun_w(V[j])
-        w('    ;')
-        w('  \\end{pgfonlayer}')
-
-        w('')
-        w('\\end{tikzpicture}')
-        w('')
-        w('\\end{document}')
-
-    def write(self, filename, compilepdf=False):
-        """ generate latex  code """
-
-        f = open(filename+'.tex', 'w')
-        w = lambda s: f.write(s+'\n')
-
-        w('\\documentclass{article}')
-
-        self._write_construction(f.write)
-
-        f.close()
-
-        if compilepdf:
-            self.compilepdf(filename)
-
-    def compilepdf(self, filename):
-        """ make using pdflatex to compile the tex file"""
-        import os
-        os.system('pdflatex ' + filename + '.tex')
-
-
-class XDSMCJK(XDSM):
-
-    """ XDSM_writer class with Chinese based on xetex and xeCJK package"""
-
-    def write(self, filename, compilepdf=False):
-        """ generate xatex  code """
-        import codecs
-        w = lambda s: f.write(s+'\n')
-        f = codecs.open(filename+'.tex', 'w', 'utf-8')
-
-        w(r'%# -*- coding:utf-8 -*-')
-        w('\\documentclass{article}')
-        w('\\usepackage{xeCJK}')
-        w('\\setCJKmainfont{SimSun}')
-        w('\\setmainfont{Times New Roman}')
-
-        self._write_construction(f.write)
-
-        f.close()
-
-        if compilepdf:
-            self.compilepdf(filename)
-
-    def compilepdf(self, filename):
-        filename = filename.strip()
-        if filename[-3:] == '.tex':
-            filename = filename[:-3]
-        import os
-        cmd = 'xelatex ' + filename + '.tex'
-        dirname = os.path.dirname(filename)
-        if dirname:
-            cmd += ' -output-directory="%s"' % dirname
-        ret = os.system(cmd)
-        # open it to preview
-        if ret == 0:
-            if os.name == 'posix':  # *nix
-                os.system('xdg-open' + filename + '.pdf')
-            elif os.name == 'nt':  # windows
-                os.system(filename.replace('/', '\\') + '.pdf')
diff --git a/pyKADMOS/PyXDSM/XDSM/__init__.py b/pyKADMOS/PyXDSM/XDSM/__init__.py
deleted file mode 100755
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/pyKADMOS/PyXDSM/XDSM/diagram_border.tex b/pyKADMOS/PyXDSM/XDSM/diagram_border.tex
deleted file mode 100755
index 611663598cb297864f2cdc0239e4aed3bf3fed94..0000000000000000000000000000000000000000
--- a/pyKADMOS/PyXDSM/XDSM/diagram_border.tex
+++ /dev/null
@@ -1,10 +0,0 @@
-% Define the set of tikz packages to be included in the architecture diagram document
-
-\usetikzlibrary{arrows,chains,positioning,scopes,shapes.geometric,shapes.misc,shadows} 
-
-% Set the border around all of the architecture diagrams to be tight to the diagrams themselves
-% (i.e. no longer need to tinker with page size parameters)
-
-\usepackage[active,tightpage]{preview}
-\PreviewEnvironment{tikzpicture}
-\setlength{\PreviewBorder}{5pt}
diff --git a/pyKADMOS/PyXDSM/XDSM/diagram_styles.tex b/pyKADMOS/PyXDSM/XDSM/diagram_styles.tex
deleted file mode 100755
index 95073e865ba8f4dc7302eafe1b78a4b9f27c53e8..0000000000000000000000000000000000000000
--- a/pyKADMOS/PyXDSM/XDSM/diagram_styles.tex
+++ /dev/null
@@ -1,109 +0,0 @@
-% Define all the styles used to produce XDSMs for MDO
-
-% Component types
-\tikzstyle{Optimization} = [rounded rectangle,draw,fill=blue!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{ConvergeCheck} = [rounded rectangle,draw,fill=lime!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{LP_Optimization} = [rectangle,draw,fill=blue!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{Analysis} = [rectangle,draw,fill=green!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{Function} = [rectangle,draw,fill=purple!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{MDA} = [rounded rectangle,draw,fill=orange!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{Metamodel} = [rectangle,draw,fill=yellow!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-\tikzstyle{DOE} = [rounded rectangle,draw,fill=yellow!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
-%\tikzstyle{OptFunction} = [rectangle,draw,fill=red!20,inner sep=6pt,minimum height=1cm,text badly centered]
-
-%% A simple command to give the repeated structure look for components and data
-\tikzstyle{stack} = [double copy shadow]
-
-%% A simple command to fade components and data, e.g. demonstrating a sequence of steps in an animation
-\tikzstyle{faded} = [draw=black!50,fill=white,text opacity=0.5]
-
-%% Simple fading commands for the lines
-\tikzstyle{fadeddata} = [color=black!20]
-\tikzstyle{fadedprocess} = [color=black!50]
-
-% **OLD** Component types for repeated structures (i.e. for parallel structures)
-%\tikzstyle{Optimization_i} = [double copy shadow, Optimization]
-%\tikzstyle{LP_Optimization_i} = [double copy shadow, LP_Optimization]
-%\tikzstyle{Analysis_i} = [double copy shadow, Analysis]
-%\tikzstyle{Function_i} = [double copy shadow, Function]
-%\tikzstyle{MDA_i} = [double copy shadow, MDA]
-%\tikzstyle{Metamodel_i} = [double copy shadow, Metamodel]
-%\tikzstyle{DOE_i} = [double copy shadow, DOE]
-
-% **OLD** Faded component types for, e.g. demonstrations of each step. We use these style definitions to "gray out" large parts of the diagram.
-%\tikzstyle{Optimization_fade} = [Optimization,fill=blue!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{Analysis_fade} = [Analysis,fill=green!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{Function_fade} = [Function,fill=purple!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{MDA_fade} = [MDA,fill=orange!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{Metamodel_fade} = [Metamodel,fill=yellow!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{DOE_fade} = [DOE,fill=yellow!10,draw=black!30,text opacity=0.3]
-%
-%\tikzstyle{Optimization_i_fade} = [Optimization_i,fill=blue!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{Analysis_i_fade} = [Analysis_i,fill=green!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{Function_i_fade} = [Function_i,fill=purple!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{MDA_i_fade} = [MDA_i,fill=orange!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{Metamodel_i_fade} = [Metamodel_i,fill=yellow!10,draw=black!30,text opacity=0.3]
-%\tikzstyle{DOE_i_fade} = [DOE_i,fill=yellow!10,draw=black!30,text opacity=0.3]
-
-% Data types
-\tikzstyle{DataInter} = [trapezium,trapezium left angle=75,trapezium right angle=105,draw,fill=black!10,align=center]
-\tikzstyle{DataIO} = [trapezium,trapezium left angle=75,trapezium right angle=105,draw,fill=white,align=center]
-
-% **OLD** Data types for repeated structures
-%\tikzstyle{DataInter_i} = [double copy shadow, DataInter]
-%\tikzstyle{DataIO_i} = [double copy shadow, DataIO]
-
-% **OLD** Faded data types
-%\tikzstyle{DataInter_fade} = [DataInter,draw=black!30,fill=white,text opacity=0.3]
-%\tikzstyle{DataIO_fade} = [DataIO_i,draw=black!30,fill=white,text opacity=0.3]
-%
-%\tikzstyle{DataInter_i_fade} = [DataInter_i,draw=black!30,fill=white,text opacity=0.3]
-%\tikzstyle{DataIO_i_fade} = [DataIO_i,draw=black!30,fill=white,text opacity=0.3]
-
-% Edges
-\tikzstyle{DataLine} = [color=black!40,line width=5pt]
-\tikzstyle{ProcessHV} = [-,line width=1pt,to path={-| (\tikztotarget)}]
-\tikzstyle{ProcessTip} = [-,line width=1pt]
-
-% **OLD** Faded edges
-%\tikzstyle{DataLine_fade} = [DataLine,color=black!10]
-%\tikzstyle{ProcessHV_fade} = [ProcessHV,color=black!30]
-%\tikzstyle{ProcessTip_fade} = [ProcessTip,color=black!30]
-
-% Matrix options
-\tikzstyle{MatrixSetup} = [row sep=3mm, column sep=2mm]
-
-% Declare a background layer for showing node connections
-\pgfdeclarelayer{data}
-\pgfdeclarelayer{process}
-\pgfsetlayers{data,process,main}
-
-% A new command to split the component text over multiple lines
-\newcommand{\MultilineComponent}[3]
-{
-	\begin{minipage}{#1}
-	\begin{center}
-		#2 \linebreak #3
-	\end{center}
-	\end{minipage}
-}
-
-% A new command to split the component text over multiple columns
-\newcommand{\MultiColumnComponent}[5]
-{
-	\begin{minipage}{#1}
-	\begin{center}
-	#2 \linebreak #3
-	\end{center}
-	\begin{minipage}{0.49\textwidth}
-	\begin{center}
-	#4
-	\end{center}
-	\end{minipage}
-	\begin{minipage}{0.49\textwidth}
-	\begin{center}
-	#5
-	\end{center}
-	\end{minipage}
-	\end{minipage}
-}
diff --git a/pyKADMOS/XDSM_writer/diagram_styles.tex b/pyKADMOS/XDSM_writer/diagram_styles.tex
index 95073e865ba8f4dc7302eafe1b78a4b9f27c53e8..a48d1939aa1f3f63216e3c63597d2079ebcf07bc 100755
--- a/pyKADMOS/XDSM_writer/diagram_styles.tex
+++ b/pyKADMOS/XDSM_writer/diagram_styles.tex
@@ -6,6 +6,7 @@
 \tikzstyle{LP_Optimization} = [rectangle,draw,fill=blue!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
 \tikzstyle{Analysis} = [rectangle,draw,fill=green!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
 \tikzstyle{Function} = [rectangle,draw,fill=purple!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
+\tikzstyle{Initiator} = [rectangle,draw,fill=white!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
 \tikzstyle{MDA} = [rounded rectangle,draw,fill=orange!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
 \tikzstyle{Metamodel} = [rectangle,draw,fill=yellow!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
 \tikzstyle{DOE} = [rounded rectangle,draw,fill=yellow!20,inner sep=6pt,minimum height=1cm,text badly centered,align=center]
diff --git a/pyKADMOS/sellarProblem.py b/pyKADMOS/sellarProblem.py
index d2f8acc30bf7c18d03fbbb53ef76ef32210b1c8c..79e3dc135dbbc3de2dca782d2dea7191ac11600e 100644
--- a/pyKADMOS/sellarProblem.py
+++ b/pyKADMOS/sellarProblem.py
@@ -71,13 +71,6 @@ for node, data in MCG.nodes_iter(data=True):
 MCG_part = sellarProblem.get_partitioned_graph(MCG,3,output='Graph',recursive=False, contig=True)#,tpwgts=[0.5,0.2,0.3])
 plot_graph(MCG_part, 9, color_setting='partitions', fig_size=fig_size, show_now=False)
 
-# all_nodes = find_all_nodes(function_graph_D12, category='all', subcategory='all',
-#                            print_in_log=True, attr_cond=['shape','==','o'],
-#                            print_attributes=['label', 'shape', 'execution time'])
-#
-# print 'all nodes'
-# pp.pprint(all_nodes)
-
 # Get the PSG for an MDF approach with Gauss-Seidel
 FPG_MDF = MCG.copy()
 
@@ -85,7 +78,7 @@ find_all_nodes(FPG_MDF, print_in_log=True)
 
 FPG_MDF.node['/data_schema/geometry/z1']['PSG role'] = 'design variable'
 FPG_MDF.node['/data_schema/geometry/z2']['PSG role'] = 'design variable'
-FPG_MDF.node['/data_schema/geometry/x1']['PSG role'] = 'design variable'
+#FPG_MDF.node['/data_schema/geometry/x1']['PSG role'] = 'design variable'
 FPG_MDF.node['/data_schema/analyses/g1']['PSG role'] = 'constraint'
 FPG_MDF.node['/data_schema/analyses/g2']['PSG role'] = 'constraint'
 FPG_MDF.node['/data_schema/analyses/f']['PSG role'] = 'objective'
@@ -93,9 +86,9 @@ FPG_MDF.node['/data_schema/analyses/f']['PSG role'] = 'objective'
 MDA_type = 'Gauss-Seidel'
 analysis_order = ['D1','D2']
 
-
 PSG = sellarProblem.get_PSG_for_MDF(FPG_MDF, MDA_type, analysis_order)
 
 plot_graph(PSG['process flow'], 10, color_setting='default', fig_size=fig_size, show_now=False)
+plot_graph(PSG['data flow'], 11, color_setting='default', fig_size=fig_size, show_now=False)
 
 create_XDSM(PSG,'testXDSM')
\ No newline at end of file
diff --git a/pyKADMOS/testXDSM.log b/pyKADMOS/testXDSM.log
index c5dfda67c19fb0b4d03ce6680580fb110eff60dc..660f971da5e6c6df73e083259a064ea09b04ec12 100644
--- a/pyKADMOS/testXDSM.log
+++ b/pyKADMOS/testXDSM.log
@@ -1,4 +1,4 @@
-This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2015.10.20)  17 JUN 2016 00:06
+This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2015.10.20)  20 JUN 2016 15:41
 entering extended mode
  restricted \write18 enabled.
  %&-line parsing enabled.
@@ -618,16 +618,16 @@ styles.tex
 \pgf@layerbox@process=\box43
 \pgf@layerboxsaved@process=\box44
 )
-LaTeX Font Info:    Try loading font information for U+msa on input line 28.
+LaTeX Font Info:    Try loading font information for U+msa on input line 19.
  (/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/umsa.fd
 File: umsa.fd 2013/01/14 v3.01 AMS symbols A
 )
-LaTeX Font Info:    Try loading font information for U+msb on input line 28.
+LaTeX Font Info:    Try loading font information for U+msb on input line 19.
 
 (/usr/local/texlive/2015/texmf-dist/tex/latex/amsfonts/umsb.fd
 File: umsb.fd 2013/01/14 v3.01 AMS symbols B
 )
-Overfull \hbox (1.18648pt too wide) in paragraph at lines 122--122
+Overfull \hbox (19.64833pt too wide) in paragraph at lines 195--195
 [][] 
  []
 
@@ -635,21 +635,24 @@ Preview: Tightpage -327680 -327680 327680 327680
 [1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
 (./testXDSM.aux) ) 
 Here is how much of TeX's memory you used:
- 14355 strings out of 493089
- 292890 string characters out of 6134841
- 336955 words of memory out of 5000000
- 17556 multiletter control sequences out of 15000+600000
+ 14579 strings out of 493089
+ 298143 string characters out of 6134841
+ 357592 words of memory out of 5000000
+ 17780 multiletter control sequences out of 15000+600000
  5339 words of font info for 22 fonts, out of 8000000 for 9000
  1141 hyphenation exceptions out of 8191
  55i,15n,82p,428b,952s stack positions out of 5000i,500n,10000p,200000b,80000s
 </usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfon
 ts/cm/cmmi10.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfont
-s/cm/cmr10.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/
-cm/cmsy10.pfb>
-Output written on testXDSM.pdf (1 page, 31166 bytes).
+s/cm/cmmi7.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/
+cm/cmr10.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm
+/cmr7.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm/cm
+sy10.pfb></usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm/cms
+y7.pfb>
+Output written on testXDSM.pdf (1 page, 55483 bytes).
 PDF statistics:
- 47 PDF objects out of 1000 (max. 8388607)
- 24 compressed objects within 1 object stream
+ 59 PDF objects out of 1000 (max. 8388607)
+ 33 compressed objects within 1 object stream
  0 named destinations out of 1000 (max. 500000)
  109 words of extra memory for PDF output out of 10000 (max. 10000000)
 
diff --git a/pyKADMOS/testXDSM.pdf b/pyKADMOS/testXDSM.pdf
index 71d2b6162eab6508c525ea2c775ab6b542895ab0..1f3d18b71b694779c00ca0ae62cc5574684e5676 100644
Binary files a/pyKADMOS/testXDSM.pdf and b/pyKADMOS/testXDSM.pdf differ
diff --git a/pyKADMOS/testXDSM.tex b/pyKADMOS/testXDSM.tex
index 36788681ecaf9cb7e36fe2f5d443422f11fe261f..7d6ecc23ee9ccfd6d93ff2bd273a15b5537ec375 100644
--- a/pyKADMOS/testXDSM.tex
+++ b/pyKADMOS/testXDSM.tex
@@ -16,106 +16,179 @@
   \matrix[MatrixSetup]
   {
     %Row 1
+    \node [Initiator] (Initiator) {$0,8$:\\INI}; &
+    \node [DataIO] (Optimizer-Initiator) {1: $z1^0$, $z2^0$}; &
+    \node [DataIO] (MDA-Initiator) {2: $y2^{c0}$}; &
+    \node [DataIO] (D1-Initiator) {3: $x1$}; &
     &
-    &
-    &
-    &
-    &
-    &
+    \node [DataIO] (F-Initiator) {6: $x1$}; &
     &
     \\
+    \node [DataIO] (Initiator-Optimizer) {8: $z1^*$, $z2^*$}; &
+    \node [Optimization] (Optimizer) {$1,7\to2$:\\OPT}; &
     &
-    \node [Optimization] (opt) {$0,3\to 1$:\\Optimization}; &
-    &
-    &
-    &
-    &
+    \node [DataInter] (D1-Optimizer) {3: $z2$, $z1$}; &
+    \node [DataInter] (D2-Optimizer) {4: $z2$, $z1$}; &
+    \node [DataInter] (F-Optimizer) {6: $z2$}; &
     &
     \\
     &
     &
-    \node [MDA] (mda) {$0,3\to 1$:\\MDA}; &
-    &
+    \node [MDA] (MDA) {$2,5\to3$:\\MDA}; &
+    \node [DataInter] (D1-MDA) {3: $y2^c$}; &
     &
     &
     &
     \\
+    \node [DataIO] (Initiator-D1) {8: $y1^*$}; &
     &
     &
+    \node [Analysis] (D1) {$3$:\\D1}; &
+    \node [DataInter] (D2-D1) {4: $y1$}; &
+    \node [DataInter] (F-D1) {6: $y1$}; &
     &
-    \node [Analysis] (ana0) {$0,3\to 1$:\\D1}; &
-    &
+    \node [DataInter] (G1-D1) {6: $y1$}; \\
+    %Row 5
+    \node [DataIO] (Initiator-D2) {8: $y2^*$}; &
     &
+    \node [DataInter] (MDA-D2) {5: $y2$}; &
     &
+    \node [Analysis] (D2) {$4$:\\D2}; &
+    \node [DataInter] (F-D2) {6: $y2$}; &
+    \node [DataInter] (G2-D2) {6: $y2$}; &
     \\
     &
+    \node [DataInter] (Optimizer-F) {7: $f$}; &
     &
     &
     &
-    \node [Analysis] (ana1) {$0,3\to 1$:\\D2}; &
-    &
+    \node [Function] (F) {$6$:\\F}; &
     &
     \\
     &
+    \node [DataInter] (Optimizer-G2) {7: $g2$}; &
     &
     &
     &
     &
-    \node [Function] (fun0) {$0,3\to 1$:\\G2}; &
-    &
+    \node [Function] (G2) {$6$:\\G2}; &
     \\
     &
+    \node [DataInter] (Optimizer-G1) {7: $g1$}; &
     &
     &
     &
     &
     &
-    \node [Function] (fun1) {$0,3\to 1$:\\G1}; &
-    \\
-    &
-    &
-    &
-    &
-    &
-    &
-    &
-    \node [Function] (fun2) {$0,3\to 1$:\\F}; \\
+    \node [Function] (G1) {$6$:\\G1}; \\
     %Row 9
   };
 
    % XDSM_writer process chains 
    { [start chain=process]
        \begin{pgfonlayer}{process}
-       \chainin (opt);
-       \chainin (mda)    [join=by ProcessHV];
-       \chainin (ana0)    [join=by ProcessHV];
-       \chainin (ana1)    [join=by ProcessHV];
-       \chainin (mda)    [join=by ProcessHV];
-       \chainin (fun0)    [join=by ProcessHV];
-       \chainin (opt)    [join=by ProcessHV];
+       \chainin (Initiator);
+       \chainin (Optimizer)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (Optimizer);
+       \chainin (Initiator)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (Optimizer);
+       \chainin (MDA)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (G2);
+       \chainin (Optimizer)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (G1);
+       \chainin (Optimizer)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (F);
+       \chainin (Optimizer)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (MDA);
+       \chainin (F)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (MDA);
+       \chainin (G2)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (MDA);
+       \chainin (G1)    [join=by ProcessHV];
+       \end{pgfonlayer}
+   }
+
+   { [start chain=process]
+       \begin{pgfonlayer}{process}
+       \chainin (MDA);
+       \chainin (D1)    [join=by ProcessHV];
        \end{pgfonlayer}
    }
 
    { [start chain=process]
        \begin{pgfonlayer}{process}
-       \chainin (mda);
-       \chainin (fun1)    [join=by ProcessHV];
-       \chainin (opt)    [join=by ProcessHV];
+       \chainin (D2);
+       \chainin (MDA)    [join=by ProcessHV];
        \end{pgfonlayer}
    }
 
    { [start chain=process]
        \begin{pgfonlayer}{process}
-       \chainin (mda);
-       \chainin (fun2)    [join=by ProcessHV];
-       \chainin (opt)    [join=by ProcessHV];
+       \chainin (D1);
+       \chainin (D2)    [join=by ProcessHV];
        \end{pgfonlayer}
    }
 
   \begin{pgfonlayer}{data}
     \path
     % Horizontal edges
+    (Initiator) edge [DataLine] (F-Initiator)
+    (Initiator-Optimizer) edge [DataLine] (F-Optimizer)
+    (MDA) edge [DataLine] (D1-MDA)
+    (Initiator-D1) edge [DataLine] (G1-D1)
+    (Initiator-D2) edge [DataLine] (G2-D2)
+    (Optimizer-F) edge [DataLine] (F)
+    (Optimizer-G2) edge [DataLine] (G2)
+    (Optimizer-G1) edge [DataLine] (G1)
     % Vertical edges
+    (Initiator) edge [DataLine] (Initiator-D2)
+    (Optimizer-Initiator) edge [DataLine] (Optimizer-G1)
+    (MDA-Initiator) edge [DataLine] (MDA-D2)
+    (D1-Initiator) edge [DataLine] (D1)
+    (D2-Optimizer) edge [DataLine] (D2)
+    (F-Initiator) edge [DataLine] (F)
+    (G2-D2) edge [DataLine] (G2)
+    (G1-D1) edge [DataLine] (G1)
     ;
   \end{pgfonlayer}