anchor.diff:  			[#bucket{units = Units, remain_amount = Size, name = Name,
   			termination_date = end_period(Now, Period)} | Buckets]),
   	subscription(Subscriber#subscriber{buckets = NewBuckets},
  -			ProductName, Characteristics, Now, T);
  +			Characteristics, Now, InitialFlag, T);
   subscription(#subscriber{buckets = Buckets} = Subscriber,
  -		ProductName, Characteristics, Now, [#price{type = usage,
  +		Characteristics, Now, InitialFlag, [#price{type = usage,
   		name = Name, alteration = #alteration{type = recurring,
   		period = Period, units = Units, size = Size,
   		amount = Amount}} | T]) when Period /= undefined,
  
positive.code: 			remain_amount = Size, prices = [Name],
  			termination_date = end_period(Now, Period)} | Buckets]),
  	subscription(Subscriber#subscriber{buckets = NewBuckets},
  			ProductName, Characteristics, Now, T);
  subscription(Subscriber, ProductName, Characteristics, Now, [_ | T]) ->
  	subscription(Subscriber, ProductName, Characteristics, Now, T);
  subscription(#subscriber{buckets = Buckets} = Subscriber,
  		ProductName, Characteristics, Now, []) ->
  	NewBuckets = [B#bucket{last_modified = {Now,
  			erlang:unique_integer([positive])}, id = generate_bucket_id()} || B <- Buckets],
  	P = #product_instance{start_date = Now,
  			product = ProductName, characteristics = Characteristics,
  			last_modified = {Now, erlang:unique_integer([positive])}},
  	Subscriber#subscriber{buckets = NewBuckets, product = P}.
  
  %% @hidden
  generate_bucket_id() ->
  
negative.code: 	EndDate = {Year + 1, Month, Day},
  	gregorian_datetime_to_system_time({EndDate, Time}) - 1.
  
  -spec subscription(Subscriber, Product, Characteristics, InitialFlag) ->
  		Subscriber
  	when
  		Subscriber :: #subscriber{},
  		Product :: #product{},
  		Characteristics :: [tuple()] | undefined,
  		InitialFlag :: boolean().
  %% @doc Apply product offering charges.
  %% 	If `InitialFlag' is `true' initial bucket preparation
  %% 	is done and one time prices are charged.
  %% @throws product_not_found
  subscription(#subscriber{last_modified = {Now, _}} = Subscriber,
  		#product{name = ProductName, bundle = [], price = Prices} = _Product,
  		Characteristics, true) ->
  	Subscriber1 = subscription(Subscriber, Characteristics, Now, true, Prices),
  	ProductInstance = #product_instance{start_date = Now,
  			product = ProductName, characteristics = Characteristics,
  			last_modified = {Now, erlang:unique_integer([positive])}},
  	Subscriber1#subscriber{product = ProductInstance};
  subscription(#subscriber{last_modified = {Now, _}} = Subscriber,
  		#product{name = BundleName, bundle = Bundled, price = Prices},
  		Characteristics, true) when length(Bundled) > 0 ->
  	F = fun(#bundled_po{name = P}, S) ->
  				case mnesia:read(product, P, read) of
  					[Product] ->
  						subscription(S, Product, Characteristics, true);
  					[] ->
  						throw(product_not_found)
  				end
  	end,
  	Subscriber1 = lists:foldl(F, Subscriber, Bundled),
  	Subscriber2 = subscription(Subscriber1, Characteristics, Now, true, Prices),
  	ProductInstance = #product_instance{start_date = Now,
  			product = BundleName, characteristics = Characteristics,
  			last_modified = {Now, erlang:unique_integer([positive])}},
  	Subscriber2#subscriber{product = ProductInstance}.
  %% @hidden
  subscription(#subscriber{buckets = Buckets} = Subscriber,
  		Characteristics, Now, true, [#price{type = one_time,
  		amount = Amount, units = undefined, alteration = undefined} | T]) ->
  	NewBuckets = charge(Amount, Buckets),
  	subscription(Subscriber#subscriber{buckets = NewBuckets},
  			Characteristics, Now, true, T);
  subscription(#subscriber{buckets = Buckets} = Subscriber,
  		Characteristics, Now, true, [#price{type = one_time,
  		amount = PriceAmount, name = Name,
  		alteration = #alteration{units = Units, size = Size,
  		amount = AlterationAmount}} | T]) ->
  	NewBuckets = charge(PriceAmount + AlterationAmount,
  		[#bucket{units = Units, remain_amount = Size, prices = [Name]} | Buckets]),
  	subscription(Subscriber#subscriber{buckets = NewBuckets},
  			Characteristics, Now, true, T);
  subscription(#subscriber{buckets = Buckets} = Subscriber,
  		Characteristics, Now, InitialFlag, [#price{type = recurring,
  		period = Period, amount = SubscriptionAmount, units = undefined,
  		alteration = undefined} | T]) when Period /= undefined ->
  	NewBuckets = charge(SubscriptionAmount, Buckets),
  	subscription(Subscriber#subscriber{buckets = NewBuckets},
  			Characteristics, Now, InitialFlag, T);
  subscription(#subscriber{buckets = Buckets} = Subscriber,
  		Characteristics, Now, InitialFlag,
  		[#price{type = recurring, name = Name,
  		period = Period, amount = SubscriptionAmount,
  		alteration = #alteration{units = Units, size = Size,
  