Modified to user SQLite