anchor.diff:      MaxAgeSeconds = proplists:get_value(max_age, Options, 60),
       Supervisor = proplists:get_value(supervisor, Options),
       Channel = proplists:get_value(channel, Options),
  -    {ok, #state{max_age = MaxAgeSeconds, supervisor = Supervisor, channel = Channel}, 
  +    {ok, #state{max_age = MaxAgeSeconds, supervisor = Supervisor, channel = Channel, last_pull = erlang:now()}, 
           MaxAgeSeconds * 1000}.
   
   handle_call(_From, _, State) ->
  
positive.code: 
  messages_newer_than_timestamp(_, [], Acc) ->
      lists:reverse(Acc);
  messages_newer_than_timestamp({L1, M1, S1} = Ts, [{Msg, {L2, M2, S2}}|Rest], Acc) when (L2 > L1 orelse (L2 =:= L1 andalso (M2 > M1 orelse (M2 =:= M1 andalso S2 > S1)))) ->
      messages_newer_than_timestamp(Ts, Rest, [Msg|Acc]);
  messages_newer_than_timestamp(_, _, Acc) ->
      lists:reverse(Acc).
  
  
negative.code:     NewSubscribers = [Subscriber|State#state.subscribers],
      gen_server:reply(From, ok),
      {noreply, State#state{subscribers = NewSubscribers}};
  handle_cast({From, pull, 'last', Subscriber}, State) ->
      {NewSubscribers, LastPull} = pull_messages(State#state.last_pull, Subscriber, State),
      gen_server:reply(From, ok),
      {noreply, State#state{subscribers = NewSubscribers, last_pull = LastPull}};
  handle_cast({From, pull, Timestamp, Subscriber}, State) ->
      {NewSubscribers, LastPull} = pull_messages(Timestamp, Subscriber, State),
      gen_server:reply(From, ok),
      {noreply, State#state{subscribers = NewSubscribers, last_pull = LastPull}};
  handle_cast({From, poll, undefined}, State) ->
      Now = erlang:now(),
      gen_server:reply(From, {ok, Now, lists:map(fun({Msg, _Ts}) -> Msg end, State#state.messages)}),
      {noreply, State#state{ last_pull = Now }};
  handle_cast({From, poll, Timestamp}, State) ->
      ReturnMessages = messages_newer_than_timestamp(Timestamp, State#state.messages),
      Now = erlang:now(),
      gen_server:reply(From, {ok, Now, lists:map(fun({Msg, _Ts}) -> Msg end, ReturnMessages)}),
      {noreply, State#state{ last_pull = Now }};
  handle_cast({From, push, Message}, State) ->
      Now = erlang:now(),
      LastPull = lists:foldr(fun(Sub, _) ->
                  Sub ! {self(), Now, [Message]},
                  Now
          end, State#state.last_pull, State#state.subscribers),
      gen_server:reply(From, {ok, Now}),
      CurrentMessages = messages_newer_than_timestamp(now_minus_seconds(erlang:now(), 
              State#state.max_age), State#state.messages),
      NewMessages = [{Message, Now}|CurrentMessages],
      {noreply, State#state{messages = NewMessages, subscribers = [], last_pull = LastPull}}.
  
  terminate(_Reason, _State) ->
      ok.
  