anchor.diff:                                        live_subs = Subs,
                                         queue = SQ}) ->
       case dict:find(ClientId,Subs) of
  -        {ok,Sub} ->
  -            {Pid,Packets,Sub1} = mqtt_sub_state:take(WSize,SQ,Sub),
  +        {ok,{Pid,Sub}} ->
  +            {Packets,Sub1} = mqtt_sub_state:take(WSize,SQ,Sub),
  +            S1 = S#state{live_subs = dict:store(ClientId,{Pid,Sub1},Subs)},
               send_packets_to_client(Pid,Filter,Packets),
  -            S#state{live_subs = dict:store(ClientId,Sub1,Subs)};
  +            S1;
           error -> S
       end.
   
  
positive.code: 
  send_packet_to_clients(CPids,Filter,Packet) ->
      [send_packet(CPid,Filter,Packet) || CPid <- CPids].
  
  send_packets_to_client(CPid,Filter,Packets) ->
      [send_packet(CPid,Filter,P) || P <- Packets].
  
negative.code:                                                         live_subs = Subs,
                                                          queue = Q,
                                                          retained = Ret}) ->
      {Packets,Sub} = mqtt_sub_state:new(Pid,CSeq,QoS,WSize,Q,Ret),
      send_packets_to_client(Pid,Filter,Packets),
      S#state{live_subs = dict:store(ClientId,{Pid,Sub},Subs),
              queue = shared_queue:add(ClientId,Q)}.
  
  %%
  %% Only update existing properties - this is not a new subscription
  %%
  resubscribe(ClientId,QoS,Pid,Sub,S = #state{filter = Filter,
                                              retained = Ret,
                                              queue = Q,
                                              live_subs = Subs}) ->
      {Packets,Sub1} = mqtt_sub_state:resubscribe(QoS,Q,Ret,Sub),
      send_packets_to_client(Pid,Filter,Packets),
      S#state{live_subs = dict:store(ClientId,{Pid,Sub1},Subs)}.
  
  %% @doc
  %% We know that a client is subscribed to a queue, we just don't know the index (Seq number)
  