anchor.diff:  
   %% @hidden
   
  -handle_info({Port, {data, Data}}, StateName=client, State=#state{port=Port,
  -        in_process=InProcess}) ->
  +handle_info({Port, {data, Data}}, StateName=client, State=#state{port=Port}) ->
  +    try binary_to_term(Data) of
  +        {'r', Result} ->
  +            handle_response(call, {ok, Result}, State, StateName);
  +        {'e', Result} ->
  +            handle_response(call, {error, Result}, State, StateName);
  +        Response ->
  +            error_response({invalid_response, Response}, State)
  +    catch
  +        error:badarg ->
  +            error_response({invalid_response_data, Data}, State)
  +    end;
  +handle_info({Port, {data, Data}}, StateName=server, State=#state{port=Port}) ->
       try binary_to_term(Data) of
           's' ->
               handle_response(switch, ok, State, StateName);
  -        {'r', Result} ->
  -            handle_response(call, {ok, Result}, State, StateName);
  -        {'e', Result} ->
  -            handle_response(call, {error, Result}, State, StateName)
  +        {'C', Module, Function, Args} when is_atom(Module), is_atom(Function),
  +                is_list(Args) ->
  +            Timer = gen_fsm:send_event_after(?CALL_TIMEOUT, timeout),
  +            % FIXME: proc_lib:spawn and monitor?
  +            {Pid, Monitor} = spawn_monitor(fun () ->
  +                exit(try {ok, apply(Module, Function, Args)}
  +                    catch
  +                        Class:Reason ->
  +                            {error, {Class, Reason, erlang:get_stacktrace()}}
  +                    end)
  +                end),
  +            Info = {Monitor, Timer, Pid},
  +            {next_state, StateName, State#state{call=Info}};
  +        Request ->
  +            {stop, {invalid_request, Request}, State}
       catch
           error:badarg ->
  -            case InProcess of
  -                {_, From, _Timer} ->
  -                    gen_fsm:reply(From, {error, invalid_response});
  -                undefined ->
  -                    ok
  -            end,
  -            {stop, invalid_response, State}
  +            {stop, {invalid_request_data, Data}, State}
       end;
  -handle_info({Port, {data, Data}}, StateName=server, State=#state{port=Port,
  -        queue=Queue}) ->
  -    % TODO: Check queue for responses
  -    try binary_to_term(Data) of
  -        {'C', Module, Function, Args} when is_atom(Module), is_atom(Function),
  -                is_list(Args) ->
  -            proc_lib:spawn(fun () ->
  -                Result = try {ok, apply(Module, Function, Args)}
  -                    catch
  -                        Class:Reason ->
  -                            {error, Class, Reason, erlang:get_stacktrace()}
  -                    end,
  -                Response = {'R', Result},
  -                true = port_command(Port, term_to_binary(Response))
  -                end),
  -            % TODO: Monitor process?
  -            {next_state, StateName, State};
  -        {'M', Module, Function, Args} when is_atom(Module), is_atom(Function),
  -                is_list(Args) ->
  -            proc_lib:spawn(fun () -> apply(Module, Function, Args) end),
  -            Data = term_to_binary('R'),
  -            case try_to_send(Port, Data, false) of
  -                ok ->
  -                    {next_state, StateName, State};
  -                wait ->
  -                    Queue2 = queue:in({response, Data}, Queue),
  -                    {next_state, StateName, State#state{queue=Queue2}};
  -                fail ->
  -                    {stop, port_closed, State}
  -            end;
  -        _ ->
  -            {next_state, StateName, State}
  -    catch
  -        error:badarg ->
  -            {stop, invalid_request, State}
  +handle_info({'DOWN', Monitor, process, Pid, Result}, StateName=server,
  +        State=#state{port=Port, call={Monitor, Timer, Pid}}) ->
  +    gen_fsm:cancel_timer(Timer),
  +    R = case Result of
  +        {ok, Response} ->
  +            {'r', Response};
  +        {error, Response} ->
  +            {'e', Response};
  +        Response ->
  +            {'e', {error, Response, []}}
  +    end,
  +    Data = term_to_binary(R),
  +    case send_data(Port, Data, false) of
  +        ok ->
  +            {next_state, StateName, State#state{call=undefined}};
  +        fail ->
  +            {stop, port_closed, State#state{call=undefined}}
       end;
  -% TODO: More port related handlers
  +handle_info({Port, closed}, _StateName, State=#state{port=Port}) ->
  +    {stop, port_closed, State};
  +handle_info({'EXIT', Port, Reason}, _StateName, State=#state{port=Port}) ->
  +    {stop, {port_closed, Reason}, State};
   handle_info(_Info, StateName, State) ->
       {next_state, StateName, State}.
   
  
positive.code: %%% Utility functions
  %%%
  
  try_to_send(Port, Data) ->
      try_to_send(Port, Data, true).
  
  try_to_send(Port, Data, WithTimer) ->
      try port_command(Port, Data, [nosuspend]) of
          true ->
              case WithTimer of
                  true ->
  
negative.code: %%
  
  -spec server(Event, State) -> Response when
      Event :: timeout,
      State :: #state{},
      Response :: {next_state, server, State}.
  
  server(timeout, State=#state{port=Port}) ->
      % TODO: It seems we don't need close process here?
      % TODO: We need to add request ID
      Data = term_to_binary({'e', {error, timeout, []}}),
      case send_data(Port, Data, false) of
          ok ->
              {next_state, server, State#state{call=undefined}};
          fail ->
              {stop, port_closed, State#state{call=undefined}}
      end;
  server(_Event, State) ->
      {next_state, server, State}.
  
  