I would add a class to represent the search state and pass that in by reference, rather than having more than one references to pointers.  Updating references to pointers is a bit opaque.  Having a single class probably makes it easier to make this multithreaded at some point.