     end
   end
 
-  defp stream_reduce({:cont, acc}, max, spawned, delivered, waiting, next,
-                     reducer, monitor_pid, monitor_ref, timeout, on_timeout) do
+  defp stream_reduce({:cont, acc}, max, spawned, delivered, waiting, next, config) do
+    %{monitor_pid: monitor_pid, monitor_ref: monitor_ref,
+      timeout: timeout} = config
     try do
       next.({:cont, []})
     catch

      {{^monitor_ref, position}, value} ->
        %{^position => {pid, :running}} = waiting
        waiting = Map.put(waiting, position, {pid, {:ok, value}})
        stream_reduce({:cont, acc}, max, spawned, delivered, waiting, next,
                      reducer, monitor_pid, monitor_ref, timeout, on_timeout)

      # The task at position "position" died for some reason. We check if it
      # replied already (then the death is peaceful) or if it's still running

            _other ->
              running_tasks
          end
        stream_monitor_loop(running_tasks, config)

      {:EXIT, _, _} ->
        stream_monitor_loop(running_tasks, config)
    end
  end

