Implemented ending condition based on expected number of results on the master host.