Clean and consolidate export code #190

Restoring XML backend

Backend now working, ready to split