Added query-middleware