Unify code paths of threaded greps