anchor.diff:                                  array:new(Count);
                               true ->
                                   % fill everything:
  -                                fill(DB#rrd.data, FillPolicy, Count,
  +                                fill(Data, FillPolicy, Count,
                                        (CurrentIndex + 1) rem Count,
                                        CurrentIndex,
  -                                     array:get(CurrentIndex, DB#rrd.data));
  +                                     array:get(CurrentIndex, Data));
                               _ ->
  -                                fill(DB#rrd.data, FillPolicy, Count,
  +                                fill(Data, FillPolicy, Count,
                                        (CurrentIndex + 1) rem Count,
                                        NewIndex,
  -                                     array:get(CurrentIndex, DB#rrd.data))
  +                                     array:get(CurrentIndex, Data))
                           end,
                       DB#rrd{data = array:set(NewIndex, F(Time, undefined, Value), FilledData),
                              current_index = NewIndex,
  
positive.code:                 _ -> % PastTimeSlot; ignore
                      DB
              end
      end.
  
  -spec update_with(rrd(), CurrentIndex::non_neg_integer(), Time::internal_time(), NewV, update_fun(data_type(), NewV)) -> rrd().
  update_with(DB, CurrentIndex, Time, NewValue, F) ->
      case array:get(CurrentIndex, DB#rrd.data) of
          undefined ->
              DB#rrd{data = array:set(CurrentIndex, F(Time, undefined, NewValue), DB#rrd.data)};
          OldValue ->
              DB#rrd{data = array:set(CurrentIndex, F(Time, OldValue, NewValue), DB#rrd.data)}
      end.
  
  -spec fill(array(), fill_policy_type(), pos_integer(), non_neg_integer(), non_neg_integer(), data_type() | undefined) -> array().
  
negative.code:                    StepSize::timespan(), CurrentSlot::non_neg_integer(),
                     SlotCount::pos_integer()) -> non_neg_integer()| future | past.
  time2slotidx(Time, CurrentTime, StepSize, CurrentSlot, SlotCount) ->
      case is_current_slot(Time, CurrentTime, StepSize) of
          true -> CurrentSlot;
          _ ->
              case is_future_slot(Time, CurrentTime, StepSize) of
                  true -> future;
                  _ ->
                      SlotOffset = SlotCount + (Time - CurrentTime) div StepSize,
                      if SlotOffset > 0 -> (CurrentSlot + SlotOffset) rem SlotCount;
                         true           -> past
                      end
  