Better support for CSVs

Better pattern matching for reading and writing CSVs