Analysis script update for output to CSV