anchor.diff:  -record(state, {
       clients
   }).
  +-record(client_info, {
  +    pid
  +}).
  +
  +-include("lager.hrl").
   
   %% API.
   
  
positive.code: 
  %% gen_server.
  init([]) ->
  	{ok, #state{clients=[]}}.
  
  %handle_call
  handle_call({join, ClientPid}, _From, State) ->
      ClientPidStr = pid_to_list(ClientPid),
      Clients = State#state.clients,
      {JoinedResult, NewState} = case lists:member(ClientPid, Clients) of
          true -> 
              ResultBin = iolist_to_binary([ClientPidStr, " is already in the xnest!"]),
              {{ok, ResultBin}, State};
          false ->
              NewClients = [ClientPid | Clients],
              ResultBin = iolist_to_binary([ClientPidStr, " is successfully joined the xnest!"]),
              {{ok, ResultBin}, State#state{clients = NewClients}}
      end,
      {reply, JoinedResult, NewState};
  handle_call({leave, ClientPid}, _From, State) ->
      ClientPidStr = pid_to_list(ClientPid),
      Clients = State#state.clients,
      {LeftResult, NewState} = case lists:member(ClientPid, Clients) of
          true ->
              NewClients = lists:delete(ClientPid, Clients),
              ResultBin = iolist_to_binary([ClientPidStr, " is successfully left the xnest!"]),
              {{ok, ResultBin}, State#state{clients = NewClients}};
          false ->
              ResultBin = iolist_to_binary([ClientPidStr, " is not in the xnest!"]),
              {{ok, ResultBin}, State}
      end,
      {reply, LeftResult, NewState};
  
  handle_call({status, client_counts}, _From, State) ->
      ClientCOunts = length(State#state.clients),
  	{reply, {ok, ClientCOunts}, State};
  handle_call({status}, _From, State) ->
  	{reply, {ok, State}, State};
  
negative.code: handle_cast({From, text, Message}, State) ->
      %%TBD, use lists:foldr for deploy message is not effective, we should think about another way.
      Clients = State#state.clients,
      DeployFun = fun({Client, _ClientInfo}, AccIn) ->
          case is_process_alive(Client) of
              true ->
                  Client ! {From, text, Message},
                  AccIn;
              false ->
                  %%TBD, here should inform manager client ws is dead
                  ets:delete(Clients, Client),
                  [Client|AccIn]
          end
      end,
  
      {_DeployMsgResult, NewState} = try
          %%TBD, here change sync to asyn simply by spawn, consider it again.
          %_DeadClients = ets:foldr(DeployFun, [], Clients),
          spawn(ets, foldr, [DeployFun, [], Clients]),
          {{ok, <<"Message successfully deployed!">>}, State}
      catch _:_ ->
          {{error, <<"Error occured when deploy message!">>}, State}
      end,
  	{noreply, NewState};
  
  handle_cast(_Msg, State) ->
  	{noreply, State}.
  