Updates and fixes to data API

I added some null safety to the data import/export functions (particularly the array handling) and created the first couple unit tests for both import and export. Please make the other unit tests follow this basic pattern of isolating the data types (where possible, of course).