anchor.diff:  	refund(ServiceId, ChargingKey, SessionId, Buckets, []).
   %% @hidden
   refund(ServiceId, ChargingKey, SessionId,
  -		[#bucket{reservations = Reservations} = H | T], Acc) ->
  +		[#bucket{attributes = #{reservations := Reservations}} = H | T], Acc) ->
   	refund(ServiceId, ChargingKey, SessionId,
  -			H, Reservations, T, [], Acc);
  +			H, maps:to_list(Reservations), T, [], Acc);
   refund(_, _, _, [], Acc) ->
   	lists:reverse(Acc).
   %% @hidden
   refund(ServiceId, ChargingKey, SessionId,
  -		#bucket{remain_amount = R} = Bucket1,
  -		[{_, 0, Amount, ServiceId, ChargingKey, SessionId} | T1],
  +		#bucket{remain_amount = R, attributes = Attributes} = Bucket1,
  +		[{SessionId, #{debit := 0, reserve := Amount, service_id := ServiceId,
  +				charging_key := ChargingKey}} | T1],
   		T2, Acc1, Acc2) ->
  +	NewReservations = maps:from_list(lists:reverse(Acc1) ++ T1),
   	Bucket2 = Bucket1#bucket{remain_amount = R + Amount,
  -			reservations = lists:reverse(Acc1) ++ T1},
  +			attributes = Attributes#{reservations => NewReservations}},
   	refund(ServiceId, ChargingKey, SessionId, T2, [Bucket2 | Acc2]);
   refund(ServiceId, ChargingKey, SessionId,
  -		#bucket{remain_amount = R} = Bucket1,
  -		[{TS, Debit, Amount, ServiceId, ChargingKey, SessionId} | T1],
  +		#bucket{remain_amount = R, attributes = Attributes} = Bucket1,
  +		[{SessionId, #{ts := TS, debit := Debit, reserve := Amount,
  +				service_id := ServiceId, charging_key := ChargingKey}} | T1],
   		T2, Acc1, Acc2) ->
  -	Refunded = {TS, Debit, 0, ServiceId, ChargingKey, SessionId},
  -	NewReservation = [Refunded | T1],
  +	Refunded = {SessionId, #{ts => TS, debit => Debit, reserve => 0,
  +			service_id => ServiceId, charging_key => ChargingKey}},
  +	NewReservations = maps:from_list(lists:reverse(Acc1) ++ [Refunded | T1]),
   	Bucket2 = Bucket1#bucket{remain_amount = R + Amount,
  -			reservations = lists:reverse(Acc1) ++ NewReservation},
  +			attributes = Attributes#{reservations => NewReservations}},
   	refund(ServiceId, ChargingKey, SessionId, T2, [Bucket2 | Acc2]);
   refund(ServiceId, ChargingKey, SessionId, Bucket,
   		[H | T1], T2, Acc1, Acc2) ->
   	refund(ServiceId, ChargingKey, SessionId, Bucket,
   			T1, T2, [H | Acc1], Acc2);
  -refund(ServiceId, ChargingKey, SessionId, Bucket1, [], T, Acc1, Acc2) ->
  -	Bucket2 = Bucket1#bucket{reservations = lists:reverse(Acc1)},
  +refund(ServiceId, ChargingKey, SessionId,
  +		#bucket{attributes = Attributes} = Bucket1, [], T, Acc1, Acc2) ->
  +	NewReservations = maps:from_list(lists:reverse(Acc1)),
  +	Bucket2 = Bucket1#bucket{attributes =
  +			Attributes#{reservations => NewReservations}},
   	refund(ServiceId, ChargingKey, SessionId, T, [Bucket2 | Acc2]).
   
   -spec filter_prices_tod(Timestamp, Prices) -> Prices
  
positive.code: %% @hidden
  convert1(Type, Size, ServiceId, ChargingKey, SessionId, Now, CentsBuckets,
  		[#bucket{units = Type, name = "session", remain_amount = R,
  		reservations = Reservations} = B | T], Acc) ->
  	F = fun({_, _, _, ServiceId1, ChargingKey1, SessionId1})
  					when ServiceId1 =:= ServiceId,
  					ChargingKey1 =:= ChargingKey, SessionId1 == SessionId ->
  				true;
  			({_, _, _, _, _, _}) ->
  				false
  	end,
  	case lists:any(F, Reservations) of
  		true ->
  			NewBucket = B#bucket{remain_amount = R + Size,
  					last_modified = {Now, erlang:unique_integer([positive])}},
  
negative.code: 						{NewUnitsCharged, 0, Buckets4}
  								when NewUnitsCharged < NewChargeUnits->
  							Now = erlang:system_time(millisecond),
  							Reservation = #{ts => Now, debit => 0,
  									reserve => NewUnitsCharged - NewChargeUnits,
  									service_id => ServiceId, charging_key => ChargingKey},
  							Attributes = #{bucket_type => session,
  									reservations => #{SessionId => Reservation}},
  							LM = make_lm(),
  							Buckets5 = [#bucket{id = make_id(LM), last_modified = LM,
  									start_date = Now, end_date = Now,
  									remain_amount = 0, attributes = Attributes,
  									units = Units, product = [ProductId]} | Buckets4],
  							charge3(Service, ServiceId, Product, Buckets5, interim,
  									DebitAmount, {Units, UnitsCharged + NewUnitsCharged},
  