refactoring database.ModernQuery