anchor.diff:  			ServiceId, ChargingKey, SessionId, T, Charged, Acc);
   charge_session(Type, Charge, Now, ServiceId, ChargingKey, SessionId,
   		[#bucket{units = Type, remain_amount = Remain,
  -		reservations = Reservations} = B | T], Charged, Acc) when Charge > 0 ->
  -	case lists:keytake(SessionId, 6, Reservations) of
  -		{value, {_, DebitedAmount, ReservedAmount,
  -				ServiceId, ChargingKey, _}, NewReservations}
  -				when ReservedAmount >= Charge ->
  +		attributes = Attributes} = B | T], Charged, Acc) when Charge > 0 ->
  +	#{reservations := Reservations} = Attributes,
  +	case maps:take(SessionId, Reservations) of
  +		{#{debit := DebitedAmount, reserve := ReservedAmount,
  +				service_id := ServiceId, charging_key := ChargingKey},
  +				NewReservations1} when ReservedAmount >= Charge ->
   			NewDebitedAmount = DebitedAmount + Charge,
   			NewReservedAmount = ReservedAmount - Charge,
  -			NewReservation = {Now, NewDebitedAmount, NewReservedAmount,
  -					ServiceId, ChargingKey, SessionId},
  -			NewAcc = [B#bucket{reservations = [NewReservation | NewReservations],
  +			NewReservations2 = NewReservations1#{SessionId => #{ts => Now,
  +					debit => NewDebitedAmount, reserve => NewReservedAmount,
  +					service_id => ServiceId, charging_key => ChargingKey}},
  +			NewAcc = [B#bucket{attributes = Attributes#{reservations => NewReservations2},
   					last_modified = {Now, erlang:unique_integer([positive])}} | Acc],
   			charge_session(Type, 0, Now, ServiceId, ChargingKey, SessionId,
   					T, Charged + Charge, NewAcc);
  -		{value, {_, DebitedAmount, ReservedAmount,
  -				ServiceId, ChargingKey, _}, NewReservations}
  +		{#{debit := DebitedAmount, reserve := ReservedAmount,
  +				service_id := ServiceId, charging_key := ChargingKey}, NewReservations1}
   				when ReservedAmount < Charge, Remain >= (Charge - ReservedAmount) ->
   			NewDebitedAmount = DebitedAmount + Charge,
  -			NewReservation = {Now, NewDebitedAmount, 0,
  -					ServiceId, ChargingKey, SessionId},
  +			NewReservations2 = NewReservations1#{SessionId => #{ts => Now,
  +					debit => NewDebitedAmount, reserve => 0,
  +					service_id => ServiceId, charging_key => ChargingKey}},
   			NewAcc = [B#bucket{remain_amount = Remain - (Charge - ReservedAmount),
   					last_modified = {Now, erlang:unique_integer([positive])},
  -					reservations = [NewReservation | NewReservations]} | Acc],
  +					attributes = Attributes#{reservations => NewReservations2}} | Acc],
   			charge_session(Type, 0, Now, ServiceId, ChargingKey, SessionId,
   					T, Charged + Charge, NewAcc);
  -		{value, {_, DebitedAmount, ReservedAmount,
  -				ServiceId, ChargingKey, _}, NewReservations}
  +		{#{debit := DebitedAmount, reserve := ReservedAmount,
  +				service_id := ServiceId, charging_key := ChargingKey}, NewReservations1}
   				when ReservedAmount < Charge, Remain >= 0,
   				Remain < (Charge - ReservedAmount) ->
   			NewDebitedAmount = DebitedAmount + (Remain + ReservedAmount),
  -			NewReservation = {Now, NewDebitedAmount, 0,
  -					ServiceId, ChargingKey, SessionId},
  +			NewReservations2 = NewReservations1#{SessionId => #{ts => Now,
  +			debit => NewDebitedAmount, reserve => 0, service_id => ServiceId,
  +			charging_key => ChargingKey}},
   			NewAcc = [B#bucket{remain_amount = 0,
   					last_modified = {Now, erlang:unique_integer([positive])},
  -					reservations = [NewReservation | NewReservations]} | Acc],
  +					attributes = Attributes#{reservations => NewReservations2}} | Acc],
   			charge_session(Type, Charge - ReservedAmount - Remain,
   					Now, ServiceId, ChargingKey, SessionId,
   					T, Charged + ReservedAmount + Remain, NewAcc);
  
positive.code: 							ChargingKey, SessionId, Buckets3),
  					Rated3 = rated(Debits, Rated2),
  					Now = erlang:system_time(millisecond),
  					NewReservation = {Now, UnitsCharged, 0,
  							ServiceId, ChargingKey, SessionId},
  					LM = make_lm(),
  					Buckets5 = [#bucket{id = make_id(LM), last_modified = LM,
  							start_date = Now,
  							remain_amount = PriceCharged - PriceCharge,
  							reservations = [NewReservation],
  							units = cents, product = [ProductId]} | Buckets4],
  					charge3(Service, ServiceId, Product, Buckets5, final, DebitAmount, {Units, TotalUnits},
  							ReserveAmount, ReserveAmount, SessionId, Rated3, ChargingKey, Buckets)
  			end
  
negative.code: 					Now, Debits#{Units => N + Debit},
  					[B#bucket{remain_amount = R + Refund,
  					last_modified = {Now, erlang:unique_integer([positive])},
  					attributes = Attributes#{reservations
  							=> maps:from_list(NewReservations)}} | Acc])
  	end;
  get_final([], _, _, _, _, Debits, Acc) ->
  	{Debits, lists:reverse(Acc)}.
  
  %% @hidden
  get_debits(undefined, undefined, SessionId,
  		[{SessionId, #{debit := Debited, reserve := Reserved}} | T],
  		Debit, Refund, Acc) ->
  	get_debits(undefined, undefined, SessionId,
  			T, Debit + Debited, Refund + Reserved, Acc);
  get_debits(ServiceId, ChargingKey, SessionId,
  		[{SessionId, #{debit := Debited, reserve := Reserved,
  				service_id := ServiceId, charging_key := ChargingKey}} | T],
  		Debit, Refund, Acc) ->
  	get_debits(ServiceId, ChargingKey, SessionId,
  			T, Debit + Debited, Refund + Reserved, Acc);
  