anchor.diff:                              || {SeqId, {_Id, DI}} <- SeqInputs]),
       #state{inputs     = gb_trees:from_orddict(SeqInputs),
              input_map  = gb_trees:from_orddict(SeqMap),
  -           %TODO only set input as done when we know it is done.
  -           is_input_done = true,
  +           is_input_done = case Grouping of
  +               split -> true;
  +               _     -> false
  +           end,
  +           stage_grouping = Grouping,
  +           stage_group = Group,
              max_seq_id = length(Inputs)}.
   
   -spec init_replicas(seq_id(), data_input(), label_grouping(), group())
  
positive.code: 
  -spec add_inputs(done | [{input_id(), data_input()}], state()) -> state().
  add_inputs(done, S) ->
      S;
  add_inputs(NewInputs, #state{inputs = Inputs} = S) ->
      InputList = gb_trees:to_list(Inputs),
      AggInputs = gb_trees:from_orddict(orddict:from_list(NewInputs ++ InputList)),
      S#state{inputs = AggInputs}.
  
  -spec all_seq_ids(state()) -> [seq_id()].
  all_seq_ids(#state{max_seq_id = MaxSeqId}) ->
  
negative.code:           % {seq_id(), rep_id()} -> fail_info()
            input_map  = gb_trees:empty() :: disco_gbtree({seq_id(), rep_id()}, fail_info()),
            is_input_done                 :: boolean(),
            stage_grouping                :: label_grouping(),
            stage_group                   :: group(),
            max_seq_id                    :: seq_id()}).
  -type state() :: #state{}.
  
  