anchor.diff:          (BufCnt == 0) -> State;                                    % no data, nothing to do, keep stack
           (BufBot == GuiBot) andalso (GuiCol == false) -> State;     % no new data, nothing to do, keep stack
           (GuiCnt == 0) ->                                            % (re)initialize to buffer bottom
  -            ?Debug("~p stack exec ~p", [autofilling,<<"more">>]),
               serve_bot(autofilling, <<">|">>, State#state{stack = undefined, replyToFun = ReplyTo});
           true ->
               % serve new data at the bottom of the buffer, ask client to come back
  -            ?Debug("Guicnt != 0 ~p ~p", [autofilling,<<"more">>]),
               gui_append(#gres{state = autofilling, loop = <<"more">>, focus = -1}, State#state{stack = undefined, replyToFun=ReplyTo})
       end;
   serve_stack(_SN, #state{bufCnt=BufCnt,bufBot=BufBot,guiCnt=GuiCnt,guiBot=GuiBot,guiCol=GuiCol, stack = {button, <<">|">>, ReplyTo}} = State) ->
  
positive.code: serve_stack(SN, #state{stack={button,<<">>">>,RT},gl=GL,bufBot=BufBot,guiBot=GuiBot}=State0) ->
      case lists:member(GuiBot,keys_before(BufBot,GL-1,State0)) of
          false ->    % deferred forward can be executed now
                      ?Debug("~p stack exec ~p", [SN,<<">>">>]),
                      serve_bot(SN,<<"">>,State0#state{tailLock=true,stack=undefined, replyToFun=RT});
          true ->     State0#state{tailLock=true}  % buffer has not grown by 1 max gui length yet, keep the stack
      end;
  serve_stack(SN, #state{bufCnt=BufCnt,stack={button,Target,RT}}=State0) when is_integer(Target), (BufCnt>=Target) ->
      % deferred target can be executed now
      ?NoDbLog(debug, [], "~p stack exec ~p", [SN,Target]),
      serve_target(SN,Target,State0#state{tailLock=true,stack=undefined,replyToFun=RT});
  serve_stack(tailing, #state{stack={button,<<">|...">>,RT}}=State0) ->
      serve_stack(tailing, State0#state{stack={button,<<"tail">>,RT}});
  serve_stack(tailing, #state{stack={button,<<"...">>,RT}}=State0) ->
      serve_stack(tailing, State0#state{stack={button,<<"tail">>,RT}});
  serve_stack(tailing, #state{bufCnt=BufCnt,bufBot=BufBot,guiCnt=GuiCnt,guiBot=GuiBot,guiCol=GuiCol,stack={button,<<"tail">>,RT},tailLock=TailLock,replyToFun=ReplyTo}=State0) ->
      ?NoDbLog(debug, [], "~p serve_stack ~p", [tailing,<<"tail">>]),
      if
          TailLock -> 
              reply_stack(tailing, ReplyTo, State0);                  % tailing is cancelled
          (BufCnt == 0) -> State0;                                    % no data, nothing to do, keep stack
          (BufBot == GuiBot) andalso (GuiCol == false) -> State0;     % no new data, nothing to do, keep stack
          (GuiCnt == 0) ->                                            % (re)initialize to buffer bottom
              ?Debug("~p stack exec ~p", [tailing,<<"tail">>]),
              serve_bot(tailing,<<"tail">>,State0#state{stack=undefined,replyToFun=RT});
          true ->
              % serve new data at the bottom of the buffer, ask client to come back
              ?NoDbLog(debug, [], "~p stack exec ~p", [tailing,<<"tail">>]),
              gui_append(#gres{state=tailing,loop= <<"tail">>,focus=-1},State0#state{stack=undefined,replyToFun=RT})
      end;
  serve_stack(autofilling, #state{bufCnt=BufCnt,bufBot=BufBot,guiCnt=GuiCnt,guiBot=GuiBot,guiCol=GuiCol, stack = {button, <<"more">>, ReplyTo}} = State) ->
  
negative.code:         %% driver session maps to imem_sec:fetch_recs_async(SKey, Opts, Pid, Sock)
          %% driver session maps to imem_meta:fetch_recs_async(Opts, Pid, Sock)
          ok -> 
              % ?Info("fetch(~p, ~p, ~p) ok", [FetchMode, TailMode, State0#state.pfc+1]),
              State0#state{pfc=State0#state.pfc+1};
          {_, Error} -> 
              ?Error("fetch(~p, ~p) -> ~p", [FetchMode, TailMode, Error]),
  