anchor.diff:  %%--------------------------------------------------------------------
   handle_call({get_or_create, MReq}, _From, State) ->
       CReq = MReq#mreq.creq,
  -    {StoredSession, CReq1} = cowboy_req:cookie(?MSESSION, CReq),
  -    Session =
  -	case  cowboy_req:path(CReq) of
  +    {BrowserSessionKey, CReq1} = cowboy_req:cookie(?MSESSION, CReq),
  +    {Session, CReq2} =
  +	case cowboy_req:path(CReq) of
   	    {<<"/favicon.ico">>, _} -> 
  -		undefined;
  +		{#session{key=undefined, new=false}, CReq1};
   	    _Else ->
  -		case StoredSession of
  -		    undefined ->
  -			not_valid;
  -		    SessionBin ->
  -			S = binary_to_list(SessionBin),
  -			case has_expired(S) of
  -			    true -> not_valid;
  -			    false -> S
  -			end
  +		S = get_session(BrowserSessionKey, State#state.sessiontime),
  +		io:format("session: ~p~n", [S]),
  +		case S#session.new of
  +		    true ->
  +			NewCReq = 
  +			    cowboy_req:set_resp_cookie(
  +			      ?MSESSION, 
  +			      S#session.key, [], CReq1),
  +			{S, NewCReq};
  +		    false ->
  +			{S, CReq1}
   		end
   	end,
  -    {Session1, CReq2} =
  -	case Session of
  -	    not_valid ->
  -		NewSession = add_new_session(State#state.sessiontime),
  -		R = cowboy_req:set_resp_cookie(
  -		      ?MSESSION, 
  -		      NewSession, [], CReq1),
  -		{NewSession, R};
  -	    Session -> {Session, CReq1}
  -	end,
  -    Reply =  {ok, Session1, MReq#mreq{creq=CReq2}},
  +    Reply =  {ok, Session, MReq#mreq{creq=CReq2}},
       {reply, Reply, State};
   
   handle_call(_Request, _From, State) ->
  
positive.code: 
  purge_db() ->
      Now =  now_secs(),
      MatchSpec = [{{'$1','$2'},[{'=<','$2', Now}],[true]}],
      ets:select_delete(?DB, MatchSpec).
  
negative.code: %%--------------------------------------------------------------------
  init([Mconf]) ->
      SessionTime = proplists:get_value(sessiontime, Mconf, ?DEFAULTSESSIONTIME),
      ets:new(?DB, [set, 
  		  named_table,
  		  {keypos, #session.key}]),
      erlang:send_after(?PURGETIME*1000, self(), purge_db),
      {ok, #state{sessiontime=SessionTime}}.
  
  