anchor.diff:  %%                     {stop, Reason}
   %% @end
   %%--------------------------------------------------------------------
  -init([Params, TwiML_EXT]) ->
  +init([Type, Params, TwiML_EXT]) ->
       FSM = case twiml:is_valid(TwiML_EXT) of
                 false ->
  +                  Resp = twiml:validate(TwiML_EXT),
  +                  io:format("TwiML_EXT is ~p~n-~p~n", [TwiML_EXT, Resp]),
                     Tw = [#say{text = "sorry, this call has been setup "
                                     ++ "incorrectly"}],
                     orddict:from_list(twiml:compile(Tw));
  -                   true ->
  +              true ->
                     orddict:from_list(twiml:compile(TwiML_EXT))
             end,
  -    {ok, #state{twiml_ext = TwiML_EXT, initial_params = Params,
  -               fsm = FSM, history = [{init, now(), Params}]}}.
  +    io:format("About to make log~n"),
  +    Log = make_log(Type, Params),
  +    io:format("Log is ~p~n", [Log]),
  +    {ok, #pc_state{twiml_ext = TwiML_EXT, initial_params = Params,
  +               log = Log, fsm = FSM, history = [{init, now(), Params}]}}.
   
   %%--------------------------------------------------------------------
   %% @private
  
positive.code: 
  %% API
  -export([
           start_link/2
          ]).
  
  % export for tidying up
  
negative.code: 
  state_to_num(A) -> [list_to_integer(X) || X <- string:tokens(A, ".")].
  
  run_callbacks(Rec, State, Event) ->
      Callbacks = State#pc_state.eventcallbacks,
      [Fun(Rec, State) || {Ev, Fun} <- Callbacks, Ev == Event],
      ok.
  
  make_log(Type, #twilio{} = Rec) ->
      From = Rec#twilio.from,
      To = Rec#twilio.to,
      F1 = case From of
               null -> "no from yet";
               _    -> From#twilio_from.number
           end,
      T1 = case To of
               null -> "no to yet";
               _    -> To#twilio_to.number
           end,
      #contact_log{type = Type, call_sid = Rec#twilio.call_sid,
                   from = F1, to = T1}.
  
  get_log(#pc_state{} = State) -> State#pc_state.log.
  
  get_hypertag(#pc_state{} = State) -> get_(State, "hypertag").
  
  get_site(#pc_state{} = State) -> get_(State, "site").
  
  get_(State, Key) ->
      InitParam = State#pc_state.initial_params,
      case proplists:lookup(Key, InitParam#twilio.custom_params) of
          none       -> none;
          {Key, Val} -> Val
      end.
  