anchor.diff:      {ok, _} = gun:open("identitysso.betfair.com", 443,
                          #{transport => ssl, transport_opts => SslOpts}),
   
  -    {ok, #state{credentials=Credentials}}.
  +    %% {ok, #state{credentials=Credentials, keep_alive = 10000}}.
  +    {ok, #state{credentials=Credentials, keep_alive = 1000 * 60 * 60 * 60}}.
  +
   
   handle_call(token, _From, #state{token=Token} = State) ->
       {reply, Token, State};
  
positive.code: 
  -export_type([token/0]).
  
  -record(state, {credentials::betfair:credentials(), connection, token}).
  
  %%%===================================================================
  %%% API
  
negative.code:     Reply = ok,
      {reply, Reply, State}.
  
  handle_cast({token, Token}, State) ->
      lager:info("Updating token with ~p", [Token]),
  
      {noreply, State#state{token=Token}};
  handle_cast(_Msg, State) ->
      {noreply, State}.
  
  
  handle_info({token, Token}, #state{token=Token} = State) when is_binary(Token) ->
      lager:info("Updating with token ~p", [Token]),
      gproc_ps:publish(?SCOPE, session_token, Token),
      {noreply, State#state{token=Token}};
  handle_info({token, Token}, State) ->
      lager:info("Updating with first token with ~p", [Token]),
      gproc_ps:publish(?SCOPE, session_token, Token),
      {noreply, State#state{token=Token}};
  handle_info(keep_alive, #state{token=Token, connection=Connection,
                                 credentials=Credentials} = State) ->
      _ = lager:info("Keeping session ~p alive..", [Token]),
  
      #{app_key := Appkey} = Credentials,
      Headers = [{<<"Content-Type">>, "application/json"},
                    {<<"X-Application">>, Appkey},
                    {<<"X-Authentication">>, Token}],
  
      Stream = gun:get(Connection, "/api/keepAlive", Headers),
      _ = receive_response(self(), Stream, Connection, fun keep_alive_handler/1),
      _ = keep_alive(State#state.keep_alive),
      {noreply, State};
  handle_info(login, #state{credentials=Credentials,
                            connection=Connection} = State) ->
      #{app_key := Appkey} = Credentials,
      lager:info("Logging in"),
      ReqBody = betfair_http:url_encode(maps:without([app_key], Credentials)),
      ReqHeaders = [{<<"Content-Type">>, "application/x-www-form-urlencoded"},
                    {<<"X-Application">>, Appkey}],
      Stream = gun:post(Connection, "/api/certlogin", ReqHeaders, ReqBody),
      _ = receive_response(self(), Stream, Connection, fun login_handler/1),
      _ = keep_alive(State#state.keep_alive),
      {noreply, State};
  handle_info({gun_up, Connection, _Transport}, State) ->
      lager:info("Connection established .."),
      self() ! login,
  