Added query types with more dependencies. Extracted query execution into WrapQuery.