implement export, needs proper unittests though, fix 31