Initial version of queryRecursive (happy path works)