Improved the way it saves to csv

Change-Id: I8b165d81a899d203651b50d7db21ba9a57c9f9e6