anchor.diff:      BM = {Bucket, Metric},
       case ets:lookup(T, BM) of
   		%% If the data wo got is just before the cache we can prepend it.
  -        [{BM, _Start, End, V}]
  -          when (Time + Len) == _Start ->
  +        [{BM, Start, End, V}]
  +          when (Time + Len) == Start ->
  +			Delta = Start - Time,
               ets:update_element(T, BM,
                                  [{2, Time},
  -								{3, End},
  +								{3, End + Delta},
                                   {4, <<Value/binary, V/binary>>}]),
               State;
   		%% If the data is before the first package in the cache we just don't
  
positive.code: 		%% When the Delta of start time and this package is greater then the
  		%% cache time we flush the cache and start a new cache with a new
  		% package
          [{BM, Start, _, V}]
            when (Time - Start) >= CT ->
              ets:delete(T, BM),
              ets:insert(T, {BM, Time, Time + Len, Value}),
              do_write(Bucket, Metric, Start, V, State);
          [{BM, Start, _, V}] ->
              ets:update_element(T, BM,
  
negative.code:                                 {4, compact(Time, Value, Start, V)}]),
  			State;
          [] ->
  			Jitter = random:uniform(20) - 10,
              ets:insert(T, {BM, Time, Time + CT + Jitter, Value}),
              State
      end.
  
  