Refactored CoDesignXML, pushed logic out to methods.