anchor.diff:      fun({_,QSeq1}) -> {RetSeq,QSeq1 + 1} end.
   
   
  -new(Pid,CSeq,QoS,WSize,Q,Ret) ->
  -    new(Pid,CSeq,QoS,undefined,WSize,Q,Ret).
  +new(CSeq,QoS,WSize,Q,Ret) ->
  +    new(CSeq,QoS,undefined,WSize,Q,Ret).
   
  -new(Pid,CSeq,QoS,From,WSize,Q,Ret) ->
  -    Sub = #sub{pid = Pid,
  -               client_seq = CSeq,
  +new(CSeq,QoS,From,WSize,Q,Ret) ->
  +    Sub = #sub{client_seq = CSeq,
                  qos = QoS},
       iterator_from(From,WSize,Q,Ret,Sub).
   
  
positive.code: %% - The Client has consumed one or more package and has increased its window size
  %% - There may be new messages to send
  %% @end
  take(Num,Q,Sub = #sub{pid = Pid,window = LastWSize}) ->
      TotalToTake = Num + LastWSize,
      {RetPs,Sub1} = take_retained(TotalToTake,Sub),
  
      QToTake = TotalToTake - length(RetPs),
      {QPs,Sub2} = take_queued(QToTake,Q,Sub1),
      {Pid,RetPs ++ QPs,Sub2}.
  
  
  take_retained(TotalToTake,Sub = #sub{next_in_q = NextInQ,
                                       retained_msgs = RetWaiting,
                                       next_retained = RetSeq}) ->
      {Taken,RetRest} = shared_set:take(TotalToTake,RetWaiting),
      NumTaken = length(Taken),
      RetPs = enumerate(true,NextInQ,RetSeq,Taken),
      {RetPs,Sub#sub{retained_msgs = RetRest,
                     next_retained = RetSeq + NumTaken,
                     window = TotalToTake - NumTaken}}.
  
  take_queued(RestWSize,Q,Sub = #sub{retained_msgs = RetSeq,
                                     next_in_q = NextInQ}) ->
      Taken = shared_queue:take(NextInQ,NextInQ + RestWSize,Q),
      NumTaken = length(Taken),
      QPs = enumerate(false,NextInQ,RetSeq,Taken),
      {QPs,Sub#sub{next_in_q = NextInQ + NumTaken ,
                   window = RestWSize - NumTaken}}.
  
  enumerate(IsRetained,QSeq,RetSeq,Packets) ->
      IncFun = inc_fun(IsRetained,RetSeq,QSeq),
  
negative.code: is_old(MsgCSeq,#sub{client_seq = CSeq}) when CSeq >= MsgCSeq -> true;
  is_old(_,_) -> false.
  
  %% @doc
  %%
  %% @end
  take_any(Q,Sub) ->
      take(0,Q,Sub).
  
  %% @doc
  