Simplified logic in wait_for_completion.