anchor.diff:  
   -define(COUNTER, riak_dt_gcounter).
   
  +%% The maximum number of impressions for each advertisement to display.
  +-define(MAX_IMPRESSIONS, 5).
  +
  +%% The number of events to sent to clients.
  +-define(NUM_EVENTS, 5000).
  +
  +%% The number of clients.
  +-define(NUM_CLIENTS, 10).
  +
   -record(ad, {id, image, counter}).
   
   -record(contract, {id}).
  
positive.code:     end,
      ok = lasp:filter(AdsContracts, FilterFun, AdsWithContracts),
  
      %% Debug; print the filtered.
      timer:sleep(500),
      {ok, {_, _, AdsWithContracts0}} = lasp:read(AdsWithContracts, undefined),
      lager:info("Current ads with contracts: ~p",
                 [?SET:value(AdsWithContracts0)]),
  
      %% Launch a series of client processes, each of which is responsible
      %% for displaying a particular advertisement.
  
      %% Generate a OR-set for tracking clients.
      {ok, Clients} = lasp:declare(?SET),
  
      %% Each client takes the full list of ads when it starts, and reads
      %% from the variable store.
      lists:map(fun(Id) ->
                  ClientPid = spawn_link(?MODULE, client,
                                         [Id, AdsWithContracts, undefined]),
                  {ok, _} = lasp:update(Clients,
                                        {add, ClientPid},
                                        undefined)
                  end, lists:seq(1,5)),
  
      %% Launch a server process for each advertisement, which will block
      %% until the advertisement should be disabled.
  
      %% Create a OR-set for the server list.
      {ok, Servers} = lasp:declare(?SET),
  
      %% Get the current advertisement list.
      {ok, {_, _, AdList0}} = lasp:read(AdsWithContracts, {strict, undefined}),
      AdList = ?SET:value(AdList0),
  
      %% For each advertisement, launch one server for tracking it's
      %% impressions and wait to disable.
      lists:map(fun(Ad) ->
                  ServerPid = spawn_link(?MODULE, server, [Ad, Ads]),
                  {ok, _} = lasp:update(Servers,
                                        {add, ServerPid},
                                        undefined)
                  end, AdList),
  
      %% Get client list.
      {ok, {_, _, ClientList0}} = lasp:read(Clients, {strict, undefined}),
      ClientList = ?SET:value(ClientList0),
  
      Viewer = fun(_) ->
              Pid = lists:nth(random:uniform(5), ClientList),
              Pid ! view_ad
      end,
      lists:map(Viewer, lists:seq(1,100)),
  
      ok.
  
  %% @doc Server functions for the advertisement counter.  After 5 views,
  %%      disable the advertisement.
  %%
  server({#ad{counter=Counter}=Ad, _}, Ads) ->
      %% Blocking threshold read for 5 advertisement impressions.
      {ok, _} = lasp:read(Counter, 5),
  
      %% Remove the advertisement.
      {ok, _} = lasp:update(Ads, {remove, Ad}, Ad),
  
negative.code: 
      %% Generate a series of unique identifiers.
      RovioAdIds = lists:map(fun(_) -> druuid:v4() end, lists:seq(1, 10)),
      TriforkAdIds = lists:map(fun(_) -> druuid:v4() end, lists:seq(1, 10)),
      Ids = RovioAdIds ++ TriforkAdIds,
  
      %% Generate Rovio's advertisements.
      {ok, RovioAds} = lasp:declare(?SET),
  