Modified logic to allow CSV output without charts