Refactored query structure
Added skeleton for SQLite driver