added sqlite3 output, refactored query/save
added sqlite3