anchor.diff:                  ignore -> ok;
                   R -> comm:send(R, {clustering_shuffle_reply, comm:this(), Centroids, Epoch})
               end,
  -            {Epoch, cluster(Centroids, RemoteCentroids)}
  +            {Epoch, cluster(Centroids, RemoteCentroids, Radius)}
       end,
       case NewEpoch of % reset needed?
  -        Epoch -> {NewCentroids, Epoch, ResetTriggerState, ClusterTriggerState};
  +        Epoch -> State#state_active{centroids=NewCentroids};
           _Else ->
               NewResetTriggerState = trigger:next(ResetTriggerState),
               NewClusterTriggerState = trigger:next(ClusterTriggerState),
               % Note: NewEpoch - 1 because we will increment it in the handler for the
               % vivaldi reply
  -            {NewCentroids, NewEpoch - 1, NewResetTriggerState, NewClusterTriggerState}
  +            State#state_active{
  +                centroids=NewCentroids
  +                , local_epoch=NewEpoch - 1
  +                , reset_trigger_state=NewResetTriggerState
  +                , cluster_trigger_state=NewClusterTriggerState
  +            }
       end
       .
  
positive.code: % Helpers
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  -spec cluster(centroids:centroids(), centroids:centroids()) -> centroids:centroids().
  cluster([], RemoteCentroids) -> RemoteCentroids;
  cluster(Centroids, RemoteCentroids) ->
      % TODO extract Radius into state
      Radius = case config:read(dc_clustering_radius) of
          failed -> exit(dc_clustering_radius_not_set);
          R when R > 0 -> R;
          _Else -> exit(dc_clustering_radius_invalid)
      end,
  
      %% TODO avoid ++
      NewCentroids = mathlib:aggloClustering(Centroids ++ RemoteCentroids, Radius),
      NormalizedCentroids = lists:map(fun (Centroid) ->
                  dc_centroids:set_relative_size(Centroid,
                      0.5 * dc_centroids:get_relative_size(Centroid))
                  end, NewCentroids),
      % XXX fails: 1 = lists:foldr(fun(S, Acc) -> Acc + S end, 0, NormalizedSizes),
      NormalizedCentroids.
  
  %% @doc Gets the clustering reset interval set in scalaris.cfg.
  
negative.code: init({ResetTrigger, ClusterTrigger}) ->
      ResetTriggerState = trigger:init(ResetTrigger, fun get_clustering_reset_interval/0, reset_clustering),
      ClusterTriggerState = trigger:init(ClusterTrigger, fun get_clustering_interval/0, start_clustering_shuffle),
      Radius = case config:read(dc_clustering_radius) of
          failed -> exit(dc_clustering_radius_not_set);
          R when R > 0 -> R;
          _Else -> exit(dc_clustering_radius_invalid)
      end,
      #state_inactive{
          queued_messages = msg_queue:new()
          , reset_trigger_state = ResetTriggerState
          , cluster_trigger_state = ClusterTriggerState
          , radius=Radius
      }
      .
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Message Loop
  