anchor.diff:  	{SecondsBuckets, AccBalance2} = case lists:filter(Fseconds, Buckets2) of
   		[] ->
   			{[], AccBalance1};
  -		BucketList2 ->
  +		BucketList2 when is_list(BucketList2) ->
   			AccBal2 = build_acc(BucketList2, "accumulated seconds", seconds,
  -					ProdRef, AccBalance1),
  +					ProdRef, application:get_env(ocs, threshold_seconds), AccBalance),
   			{BucketList2, AccBal2}
   	end,
   	Fmessages = fun(#bucket{units = messages}) ->
  
positive.code: 	ocs_event:notify(accumulated, AccBlance, balance).
  
  %% @private
  accumulated_balance(Buckets, ProdRef) when is_list(Buckets) ->
  	Fcents = fun(#bucket{units = cents}) ->
  				true;
  			(_) ->
  
negative.code: 	{_MessagesBuckets, AccBalance3} = case lists:filter(Fmessages, Buckets3) of
  		[] ->
  			{[], AccBalance2};
  		BucketList3 when is_list(BucketList3) ->
  			AccBal3 = build_acc(BucketList3, "accumulated messages", messages,
  					ProdRef, application:get_env(ocs, threshold_messages), AccBalance),
  			{BucketList3, AccBal3}
  	end,
  	AccBalance3.
  
  %% @private
  build_acc(_Buckets, _Name, _Units, _ProdRef, {ok, undefined}, AccBalance) ->
  	AccBalance;
  build_acc(Buckets, Name, Units, ProdRef, {ok, UnitThreshold}, AccBalance)
  		when is_integer(UnitThreshold), UnitThreshold > 0 ->
  	case lists:sum([RA || #bucket{remain_amount = RA} <- Buckets]) of
  		0 ->
  			AccBalance;
  		TotalBalance when is_integer(TotalBalance),
  				TotalBalance < UnitThreshold ->
  			BucketRefs = [Id || #bucket{id = Id} <- Buckets],
  			[#acc_balance{id = ProdRef, name = Name, product = [ProdRef],
  					units = Units, total_balance = TotalBalance,
  					bucket = BucketRefs} | AccBalance];
  		_ ->
  			AccBalance
  	end.
  
  