Updated the script to use SQLite3