clean up and plotting