Rewrite to support non-blocking search (2)