added read/write and plotting