Clean and consolidate export code #190

Moved code, misc