init and export
implemented the write functionality