Replace SQLite code with simpler direct .csv file writing.