refactor database.ModernQuery