updated to run with sqlite3 instead of postgres