       # `Spell.cast_call` performs an asyncronous call to the remote procedure, the result will 
       # be intercepted and parsed by the block `Spell.receive_result`
       {:ok, call_id} = Spell.cast_call(state.caller, state.procedure, state.params)
-      Logger.info("<Caller> send params: #{inspect(state.params)}")
+      Logger.info("<Caller: #{inspect(state.caller)}> send params: #{inspect(state.params)}")
       
       case Spell.receive_result(state.caller, call_id) do
-        {:ok, result} -> IO.inspect handle_result(result)
+        {:ok, result} -> IO.inspect handle_result(state, result)
         {:error, reason} -> {:error, reason}
       end
 

# Start the crossbar testing server
{:ok, _pid} = Crossbar.start()

procedure = "com.spell.rpc.sum"

# Register callee to the WAMP router
{:ok, _callee} = Callee.start_link(procedure)

# Call the remote procedure passing the agruments
{:ok, _caller} = Caller.start_link(procedure, [arguments: [1, 2, 3]])

:timer.sleep(10000)

Logger.info("DONE... Stopping Crossbar.io server")


      # `Spell.cast_register` receive the callee and the procedure where it
      # has to be registered
      {:ok, _reg_id} = Spell.cast_register(callee, procedure)

      %__MODULE__{callee: callee} |> struct(options) |> loop()
    end

    defp loop(state) do
      receive do
        :stop -> :ok
        {Spell.Peer, _pid, message} -> state = handle_message(state, message)
        _ -> {:error, :wrong_message}
      after
        state.timeout -> {:error, :timeout}
