Code reorganization

Again, to avoid circular imports of classes
Table exporting

CSV file export seems to work. Can output linked data.