anchor.diff:  	{_MessagesBuckets, AccBalance3} = case lists:filter(Fmessages, Buckets3) of
   		[] ->
   			{[], AccBalance2};
  -		BucketList3 ->
  +		BucketList3 when is_list(BucketList3) ->
   			AccBal3 = build_acc(BucketList3, "accumulated messages", messages,
  -					ProdRef, AccBalance2),
  +					ProdRef, application:get_env(ocs, threshold_messages), AccBalance),
   			{BucketList3, AccBal3}
   	end,
   	AccBalance3.
   
   %% @private
  -build_acc(Buckets, Name, Units, ProdRef, AccBalance) ->
  +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 ->
  +		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]
  +					bucket = BucketRefs} | AccBalance];
  +		_ ->
  +			AccBalance
   	end.
   
  
positive.code: 	{CentsBuckets, AccBalance} = case lists:filter(Fcents, Buckets) of
  		[] ->
  			{[], []};
  		BucketList ->
  			AccBal = build_acc(BucketList, "accumulated cents", cents,
  					ProdRef, []),
  			{BucketList, AccBal}
  	end,
  	Fbytes = fun(#bucket{units = octets}) ->
  
negative.code: 	ocs_event:notify(accumulated, AccBlance, balance).
  
  %% @private
  accumulated_balance(Buckets, ProdRef) ->
  	F = fun(UnitThresholdName) ->
  			case application:get_env(ocs, UnitThresholdName) of
  				{ok, undefined} ->
  					false;
  				{ok, Threshold} when is_integer(Threshold) ->
  					true
  			end
  	end,
  	UnitThresholdNames = [threshold_cents, threshold_bytes,
  			threshold_seconds, threshold_messages],
  	accumulated_balance(Buckets, ProdRef, lists:any(F, UnitThresholdNames)).
  accumulated_balance(_Buckets, _ProdRef, false) ->
  	[];
  accumulated_balance(Buckets, ProdRef, true) when is_list(Buckets) ->
  	Fcents = fun(#bucket{units = cents}) ->
  				true;
  			(_) ->
  