publised version (export data function is worked out)