anchor.diff:              Events = dict:store(JobName, new_job_ent(Pid, Stages), Events0),
               MsgBuf = dict:store(JobName, {0, 0, []}, MsgBuf0),
               spawn(fun() -> job_event_handler(JobName, From) end),
  -            {noreply, {Events, MsgBuf}}
  +            {noreply, S#state{events = Events, msgbuf = MsgBuf}}
       end;
  -handle_call(get_jobs, _From, {Events, _MsgBuf} = S) ->
  +handle_call(get_jobs, _F, #state{events = Events} = S) ->
       {reply, do_get_jobs(Events), S};
  -handle_call({get_job_msgs, JobName, Query, N}, _From, {_Events, MsgBuf} = S) ->
  -    {reply, do_get_job_msgs(JobName, Query, N, MsgBuf), S};
  -handle_call({get_results, JobName}, _From, {Events, _MsgBuf} = S) ->
  +handle_call({get_job_msgs, JobName, Query, N}, _F, #state{msgbuf = MB} = S) ->
  +    {reply, do_get_job_msgs(JobName, Query, N, MB), S};
  +handle_call({get_results, JobName}, _F, #state{events = Events} = S) ->
       {reply, do_get_results(JobName, Events), S};
  -handle_call({get_map_results, JobName}, _From, {Events, _MsgBuf} = S) ->
  +handle_call({get_map_results, JobName}, _F, #state{events = Events} = S) ->
       {reply, do_get_map_results(JobName, Events), S};
  -handle_call({job_initialized, JobName, JobEventHandler}, _From, S) ->
  +handle_call({job_initialized, JobName, JobEventHandler}, _F, S) ->
       ets:insert(event_files, {JobName, JobEventHandler}),
       S1 = add_event("master", JobName, <<"\"New job initialized!\"">>, none, S),
       {reply, ok, S1};
  -handle_call({get_jobinfo, JobName}, _From, {Events, _MsgBuf} = S) ->
  +handle_call({get_jobinfo, JobName}, _F, #state{events = Events} = S) ->
       {reply, do_get_jobinfo(JobName, Events), S}.
   
   -spec handle_cast(term(), state()) -> gs_noreply().
  
positive.code:     MsgBufN = dict:store(JobName, {NMsg + 1, LstLen, MsgLst}, MsgBuf),
      if
          Event =:= none ->
              {Events, MsgBufN};
          true ->
              {ok, JE} = dict:find(JobName, Events),
              {dict:store(JobName, update_job_ent(JE, Event), Events),
               MsgBufN}
      end.
  
  -spec do_job_done(jobname(), state()) -> state().
  do_job_done(JobName, {Events, MsgBuf} = S) ->
      case ets:lookup(event_files, JobName) of
          [] ->
              ok;
  
negative.code:         {error, {already_started, Server}} -> {ok, Server}
      end.
  
  % events dict: jobname -> { [event()], <start_time>, <job_coordinator_pid> }
  % msgbuf dict: jobname -> { <nmsgs>, <list-length>, [<msg>] }
  -record(state, {events = dict:new() :: dict(),
                  msgbuf = dict:new() :: dict()}).
  -type state() :: #state{}.
  
  -spec init(_) -> gs_init().
  init(_Args) ->
      _ = ets:new(event_files, [named_table]),
      {ok, #state{}}.
  
  -spec handle_call(term(), from(), state()) -> gs_reply(term()) | gs_noreply().
  
  handle_call({new_job, JobPrefix, Pid, Stages}, From,
              #state{events = Events0, msgbuf = MsgBuf0} = S) ->
      case unique_key(JobPrefix, Events0) of
          invalid_prefix ->
              {reply, {error, invalid_prefix}, S};
  