anchor.diff:  broadcast_msg(Clients, Msg) ->
       [clientsock:send(C, Msg) || C <- Clients].
   
  -json_nci_details(Time, undefined, CommunityData) ->
  -    json_nci_details(Time, 0, CommunityData);
  -json_nci_details(Time, NCI, CommunityData) ->
  +json_nci_details(Time, undefined, CommunityData, Limits) ->
  +    json_nci_details(Time, 0, CommunityData, Limits);
  +json_nci_details(Time, NCI, CommunityData = {_, Sizes, _}, Limits) ->
  +    MaxCommunities = proplists:get_value(max_communities, Limits),
  +    % make a list of the largest communities and truncate the list after
  +    % MaxCommunities elements.
  +    CommunityList = [C || {C, _} <- lists:sublist(lists:sort(
  +                                        fun({_, A}, {_, B}) ->
  +                                            A > B % reverse sort
  +                                    end, dict:to_list(Sizes)), MaxCommunities)],
       jiffy:encode({[
           {<<"action">>,<<"NCIDetails">>},
           {<<"NCI">>,NCI},
           {<<"Time">>, Time},
  -        {<<"Communities">>, community_details(CommunityData)},
  -        {<<"CommunityGraph">>, community_graph(CommunityData)}
  +        {<<"Communities">>, community_details(CommunityData,
  +                                                CommunityList, Limits)},
  +        {<<"CommunityGraph">>, community_graph(CommunityData,
  +                                                CommunityList, Limits)}
       ]}).
   
  -community_graph(no_communities) ->
  +community_graph(no_communities, _CommunityList, _Limits) ->
       [];
   community_graph({{_Endpoints, _Interactions}, Sizes,
  -                                        {Cendpoints, Cinteractions}}) ->
  +                    {_Cendpoints, Cinteractions}}, CommunityList, _Limits) ->
       {[
  -        {<<"Endpoints">>, cendpoints(Cendpoints, Sizes)},
  -        {<<"Interactions">>, cinteractions(Cinteractions, Sizes)}
  +        {<<"Endpoints">>, cendpoints(CommunityList, Sizes)},
  +        {<<"Interactions">>, cinteractions(Cinteractions, CommunityList, Sizes)}
       ]}.
   
   cendpointsize(C, Sizes) ->
  
positive.code: cendpoints(Endpoints, Sizes) ->
      lists:map(fun(E) -> cendpointsize(E, Sizes) end, Endpoints).
  
  cinteractions(Interactions, Sizes) ->
      [[cendpointsize(C1, Sizes),
        cendpointsize(C2, Sizes)] || {C1,C2} <- Interactions].
  
  community_details(no_communities) ->
      [];
  community_details({{Endpoints, Interactions}, Sizes, _Comms}) ->
      [
          {[
              {<<"Interactions">>, interactions(dict_fetch(C, Interactions))},
              {<<"Endpoints">>, endpoints(dict_fetch(C, Endpoints))},
              {<<"Label">>, endpoint(C)},
              {<<"Size">>, dict:fetch(C, Sizes)}
          ]} || C <- dict:fetch_keys(Sizes)
      ].
  
  dict_fetch(Key, Dict) ->
      case dict:find(Key, Dict) of
  
negative.code: handle_cast({nci_details, Pid}, State = #?STATE{
                                              community_data = CommunityData,
                                              nci = NCI,
                                              last_nci_time = Time,
                                              limits = Limits}) ->
      clientsock:send(Pid, json_nci_details(Time, NCI, CommunityData, Limits)),
      {noreply, State};
  handle_cast({collectors, Pid}, State = #?STATE{collectors = CollectorDict,
                                                 last_qps_time = Time}) ->
  