Output to CSV + fixes