Cleaned up the export code