working SQLite implementation