Started implementing importing and exporting.

Exporting is basically finished.