Update code to use SQLite database