Improved script for running and plotting program