Added exporting and some tests.