Export cleanup
Incomplete SQL refactoring