SQLite filters refactor