Recursive hierarchy searching