Clean and consolidate export code #190

Fixes issues related to XML export of dynamics