Added in code to write to sqlite3 db