Added query method with reduce