Moved tree exporting to core.