anchor.diff:      [{NewHighVal,NewHighBelow}|NewNumsBelow] = zip_below(LastBelow, lists:sort(State#state.new_nums), []),
       NewNumsBelow1 = lists:reverse([{NewHighVal, NewHighBelow+State#state.n_above_max}| NewNumsBelow]),
       {NumsBeforeBelow,_} = lists:split(length(NewNumsBelow1), State#state.nums), 
  +
       State#state{
           nums=NumsBeforeBelow++NewNumsBelow1,
           high_trending=false,
  
positive.code:     
      incr_below(V, [{N,BelowN}|Ns], Acc) when V =< N ->
          incr_below(V, Ns, [{N,BelowN+1}|Acc]);
      incr_below(_, Ns, Acc) ->
          lists:reverse(Acc, Ns).
  
  
  % Replace the sample count with the number of samples below the value.
  
negative.code:                         n_events=NEvents,
                          nums=incr_below(Value, State#state.nums),
                          high_trending=HighTrending,
                          n_above_max=case Value =< HighValue of 
                                          true -> State#state.n_above_max;
                                          false -> State#state.n_above_max+1
                                      end
                      }
              end;
          _ ->
  