Index: priv/example/config/yaws.conf
===================================================================
--- priv/example/config/yaws.conf	(revision 0)
+++ priv/example/config/yaws.conf	(revision 0)
@@ -0,0 +1,12 @@
+logdir  = logs
+<server localhost>
+    port    = 8000
+    listen  = 127.0.0.1
+    docroot = example/www
+    appmods = <"/",erlyweb_interface_yaws>
+    <opaque>
+        appname = example
+    </opaque>
+</server>
+
+
Index: priv/example/example/www/style.css
===================================================================
--- priv/example/example/www/style.css	(revision 0)
+++ priv/example/example/www/style.css	(revision 0)
@@ -0,0 +1,14 @@
+body {
+  font-family: arial, verdana,  helvetica, sans-serif;
+  color: #353535;
+  margin:10px 0px; padding:0px;
+  text-align:center;
+}
+
+#Content {
+  width:80%;
+  margin:0px auto;
+  text-align:left;
+  padding:15px;
+} 
+H1 {font-size: 1.5em;}
\ No newline at end of file
Index: priv/example/example/www/index.html
===================================================================
--- priv/example/example/www/index.html	(revision 0)
+++ priv/example/example/www/index.html	(revision 0)
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="/style.css">
+<title>example</title>
+</head>
+<body>
+<div id="content">
+Welcome to 'example', your new <a href="http://erlyweb.org">ErlyWeb</a> app.<br><br>
+Let the <a href="http://erlang.org">Erlang</a> hacking begin!
+</div>
+</body>
+</html>
\ No newline at end of file
Index: priv/example/example/src/example_app_controller.erl
===================================================================
--- priv/example/example/src/example_app_controller.erl	(revision 0)
+++ priv/example/example/src/example_app_controller.erl	(revision 0)
@@ -0,0 +1,8 @@
+-module(example_app_controller).
+-export([hook/1]).
+
+hook(A) ->
+	{phased, {ewc, A},
+		fun(_Ewc, Data, _PhasedVars) ->
+			{ewc, html_container, index, [A, {data, Data}]}
+		end}.
\ No newline at end of file
Index: priv/example/example/src/components/example_controller.erl
===================================================================
--- priv/example/example/src/components/example_controller.erl	(revision 0)
+++ priv/example/example/src/components/example_controller.erl	(revision 0)
@@ -0,0 +1,7 @@
+-module(example_controller).
+-export([index/1]).
+-define(STUFF,[appmoddata,server_path,method,appname]).
+
+index(A) ->
+    { data , [ { atom_to_list(X) , io_lib:format("~p",[erlyweb_arg:X(A)]) } || X <- ?STUFF ] }.
+
Index: priv/example/example/src/components/html_container_view.et
===================================================================
--- priv/example/example/src/components/html_container_view.et	(revision 0)
+++ priv/example/example/src/components/html_container_view.et	(revision 0)
@@ -0,0 +1,18 @@
+<%@ index(Data) %>
+<html>
+<head>
+<title>example</title>
+<link rel="stylesheet" href="/style.css" type="text/css">
+</style>
+</head>
+<body>
+<div id="content">
+<h1>example app</h1>
+<% Data %>
+<br>
+<div width="80%" align="right">
+powered by <a href="http://erlyweb.org">ErlyWeb</a> / <a href="http://yaws.hyber.org">Yaws</a>
+</div>
+</div>
+</body>
+</html>
Index: priv/example/example/src/components/html_container_controller.erl
===================================================================
--- priv/example/example/src/components/html_container_controller.erl	(revision 0)
+++ priv/example/example/src/components/html_container_controller.erl	(revision 0)
@@ -0,0 +1,8 @@
+-module(html_container_controller).
+-export([private/0, index/2]).
+
+private() ->
+	true.
+
+index(_A, Ewc) ->
+	Ewc.
\ No newline at end of file
Index: priv/example/example/src/components/example_view.et
===================================================================
--- priv/example/example/src/components/example_view.et	(revision 0)
+++ priv/example/example/src/components/example_view.et	(revision 0)
@@ -0,0 +1,10 @@
+
+<%@ index(Stuff) %>
+    <table>
+        <% [ showvar(X,Y) || { X , Y } <- Stuff ] %>
+    </table>
+
+<%@ showvar(N,V) %>
+    <tr>
+        <td><% N %></td><td>=</td><td><% V %></td>
+    </tr>
Index: src/erlyweb/erlyweb_forms.erl
===================================================================
--- src/erlyweb/erlyweb_forms.erl	(revision 228)
+++ src/erlyweb/erlyweb_forms.erl	(working copy)
@@ -35,7 +35,7 @@
 %% @spec to_recs(A::arg() | [{ParamName::string(), ParamVal::term()}],
 %% [{Prefix::string(), Model::atom()}]) -> [Record::tuple()]
 to_recs(A, ModelDescs) when is_tuple(A), element(1, A) == arg ->
-    to_recs(yaws_api:parse_post(A), ModelDescs);
+    to_recs(erlyweb_arg:parse_post(A), ModelDescs);
 to_recs(Params, ModelDescs) ->
     Models = 
 	[{Prefix, Model, Model:new()} || {Prefix, Model} <- ModelDescs],
@@ -95,7 +95,7 @@
 %%   Fun::function()) -> {Values::[term()], Errors::[term()]} |
 %%   exit({missing_param, Field})
 validate(A, Fields, Fun) when is_tuple(A), element(1, A) == arg ->
-    validate(yaws_api:parse_post(A), Fields, Fun);
+    validate(erlyweb_arg:parse_post(A), Fields, Fun);
 validate(Params, Fields, Fun) ->
     lists:foldr(
       fun(Field, Acc) ->
@@ -115,7 +115,7 @@
 %% Fun::function()) -> {Vals, Errs} | exit({missing_params, [string()]}) |
 %% exit({unexpected_params, proplist()}) | exit({unexpected_param, string()})
 validate1(A, Fields, Fun) when is_tuple(A), element(1, A) == arg ->
-    validate1(yaws_api:parse_post(A), Fields, Fun);
+    validate1(erlyweb_arg:parse_post(A), Fields, Fun);
 validate1(Params, Fields, Fun) ->
     validate1_1(Params, Fields, Fun, {[], []}).
 
Index: src/erlyweb/erlyweb_arg.erl
===================================================================
--- src/erlyweb/erlyweb_arg.erl	(revision 0)
+++ src/erlyweb/erlyweb_arg.erl	(revision 0)
@@ -0,0 +1,40 @@
+-module(erlyweb_arg).
+-export([create/2]).
+-export([appmoddata/1,server_path/1,method/1,parse_post/1,appname/1]).
+-export([props/1,prop_insert/2,prop_find/2]).
+-export([app_data/1,app_data/2,app_controller/1,app_controller/2]).
+
+create(Mod,Arg) ->
+    {Mod,Arg,[]}.
+appmoddata({Mod,Arg,_}) ->
+    Mod:appmoddata(Arg).
+server_path({Mod,Arg,_}) ->
+    Mod:server_path(Arg).
+method({Mod,Arg,_}) ->
+    Mod:method(Arg).
+parse_post({Mod,Arg,_}) ->
+    Mod:parse_post(Arg).
+appname({Mod,Arg,_}) ->
+    Mod:appname(Arg).
+
+props({_,_,O}) ->
+    O.
+prop_insert({Mod,Arg,O},{Key,Val}) ->
+    O2 = case proplists:is_defined(Key,O) of
+        true -> proplists:delete(Key,O);
+        _    -> O
+    end,
+    {Mod,Arg,[{Key,Val}|O2]}.
+prop_find({_,_,O},Key) ->
+    proplists:lookup(Key,O).
+
+app_data(Arg) ->
+    prop_find(Arg,app_data_module).
+app_data(Arg,AppData) ->
+    prop_insert(Arg,{app_data_module,AppData}).
+
+app_controller(Arg) ->
+    prop_find(Arg,app_controller_module).
+app_controller(Arg,AppData) ->
+    prop_insert(Arg,{app_controller_module,AppData}).
+
Index: src/erlyweb/erlyweb_interface_ewgi.erl
===================================================================
--- src/erlyweb/erlyweb_interface_ewgi.erl	(revision 0)
+++ src/erlyweb/erlyweb_interface_ewgi.erl	(revision 0)
@@ -0,0 +1,19 @@
+-module(erlyweb_interface_ewgi).
+-export([out/1,handle_req/2]).
+
+out(Arg) ->
+    M = ewgi_yaws:new(?MODULE),
+    Conf = [{ appmoddata  , yaws_arg:appmoddata(Arg)  },
+            { server_path , yaws_arg:server_path(Arg) }],
+    M:run(Arg,Conf).
+
+handle_req(Env,StartResp) ->
+    Arg = erlyweb_arg_ewgi:create(Env),
+    { Arg2 , AppController , AppData } = erlyweb:prepare_request(Arg),
+    Resp = erlyweb:handle_request(Arg2,AppController,AppData),
+    handle_response(Env,StartResp,Resp).
+
+% filter out all the ehtml/yaws return stuff (ewgi-ify the response).
+handle_response(_Env,_StartResp,_Resp) ->
+    todo.
+
Index: src/erlyweb/erlyweb_arg_yaws.erl
===================================================================
--- src/erlyweb/erlyweb_arg_yaws.erl	(revision 0)
+++ src/erlyweb/erlyweb_arg_yaws.erl	(revision 0)
@@ -0,0 +1,17 @@
+-module(erlyweb_arg_yaws).
+-export([create/1]).
+-export([appmoddata/1,server_path/1,method/1,parse_post/1,appname/1]).
+
+create(A) ->
+    erlyweb_arg:create(?MODULE,A).
+appmoddata(A) -> 
+    yaws_arg:appmoddata(A).
+server_path(A) -> 
+    yaws_arg:server_path(A).
+method(A) ->
+    yaws_arg:method(A).
+parse_post(A) ->
+    yaws_api:parse_post(A).
+appname(A) ->
+    proplists:get_value("appname",yaws_arg:opaque(A)).
+
Index: src/erlyweb/erlyweb_util.erl
===================================================================
--- src/erlyweb/erlyweb_util.erl	(revision 228)
+++ src/erlyweb/erlyweb_util.erl	(working copy)
@@ -11,8 +11,7 @@
 -module(erlyweb_util).
 -author("Yariv Sadan (yarivsblog@gmail.com, http://yarivsblog.com").
 -export([log/5, create_app/2, create_component/3,
-	 get_url_prefix/1,
-	 get_cookie/2, indexify/2]).
+	 get_url_prefix/1, indexify/2]).
 
 -define(Debug(Msg, Params), log(?MODULE, ?LINE, debug, Msg, Params)).
 -define(Info(Msg, Params), log(?MODULE, ?LINE, info, Msg, Params)).
@@ -234,17 +233,8 @@
     lists:dropwhile(
       fun($?) -> true;
 	 (_) -> false
-      end, yaws_arg:appmoddata(A)).
+      end, erlyweb_arg:appmoddata(A)).
 
-
-%% @doc Get the cookie's value from the arg.
-%% @equiv yaws_api:find_cookie_val(Name, yaws_headers:cookie(A))
-%%
-%% @spec get_cookie(Name::string(), A::arg()) -> string()
-get_cookie(Name, A) ->
-    yaws_api:find_cookie_val(
-      Name, yaws_headers:cookie(A)).
-
 %% @doc Translate requests such as '/foo/bar' to '/foo/index/bar' for the given
 %% list of components. This function is useful for rewriting the Arg in the
 %% app controller prior to handling incoming requests.
@@ -254,14 +244,14 @@
 %%
 %% @spec indexify(A::arg(), ComponentNames::[string()]) -> arg()
 indexify(A, ComponentNames) ->
-    Appmod = yaws_arg:appmoddata(A),
-    Sp = yaws_arg:server_path(A),
+    Appmod = erlyweb_arg:appmoddata(A),
+    Sp = erlyweb_arg:server_path(A),
 
     Appmod1 = indexify1(Appmod, ComponentNames),
-    A1 = yaws_arg:appmoddata(A, Appmod1),
+    A1 = erlyweb_arg:appmoddata(A, Appmod1),
 
     {SpRoot, _} = lists:split(length(Sp) - length(Appmod), Sp),
-    yaws_arg:server_path(A1, SpRoot ++ Appmod1).
+    erlyweb_arg:server_path(A1, SpRoot ++ Appmod1).
      
 
 indexify1(S1, []) -> S1;
Index: src/erlyweb/erlyweb.erl
===================================================================
--- src/erlyweb/erlyweb.erl	(revision 228)
+++ src/erlyweb/erlyweb.erl	(working copy)
@@ -13,13 +13,13 @@
 -author("Yariv Sadan (yarivsblog@gmail.com, http://yarivsblog.com)").
 
 -export([
-	 create_app/2,
+         prepare_request/1,
+         handle_request/3,
+     create_app/2,
 	 create_component/2,
 	 create_component/3,
 	 compile/1,
 	 compile/2,
-	 out/1,
-	 out/2,
 	 get_initial_ewc/1,
 	 get_ewc/1,
 	 get_app_name/1,
@@ -50,15 +50,15 @@
 	Other -> Other
     end.
 
-%% @equiv create_component(Component, AppDir, [{magic, on}, {model, on}, 
+%% @equiv create_component(Component, AppDir, [{magic, on}, {model, on},
 %%                                             {erltl, off}])
 create_component(Component, AppDir) ->
     create_component(Component, AppDir, [{magic, on}, {model, on},
 					{erltl, off}]).
 
 %% @doc Create all files (model, view, and controller) for a component
-%%  that implements basic CRUD features for a database table. 'Component' 
-%%  is the name of the component and 'AppDir' is the application's root 
+%%  that implements basic CRUD features for a database table. 'Component'
+%%  is the name of the component and 'AppDir' is the application's root
 %%  directory.
 %%
 %%  This function also lets you define the following options:
@@ -75,11 +75,11 @@
 %% - `{model, Val::on | off}'
 %%   This tells Erlyweb whether to create a model file or not.
 %%
-%% - `{erltl, Val::on | off}'  
+%% - `{erltl, Val::on | off}'
 %%   This tells Erlyweb whether the view file should be an ErlTL file, or
 %%   an Erlang source file.
 %%
-%% @spec create_component(Component::atom(), AppDir::string(), 
+%% @spec create_component(Component::atom(), AppDir::string(),
 %%    Options::[option()]) -> ok | {error, Err}
 create_component(Component, AppDir, Options) ->
     case catch erlyweb_util:create_component(Component, AppDir, Options) of
@@ -128,8 +128,8 @@
 %%
 %% -  `{auto_compile_exclude, Val}', where Val is a folder in docroot (or a
 %%    URL path) which gets excluded from auto-compiling. This is useful when
-%%    erlyweb is mapped to '/' and there are a lots of static files in that 
-%%    excluded folder. Example: {auto_compile_exclude, "/static"} 
+%%    erlyweb is mapped to '/' and there are a lots of static files in that
+%%    excluded folder. Example: {auto_compile_exclude, "/static"}
 %%
 %% - `suppress_warnings' and `suppress_errors' tell ErlyWeb to not pass the
 %%   `report_warnings' and `report_errors' to compile:file/2.
@@ -139,58 +139,12 @@
 %% accepts the option {pool_id, PoolId}, which indicates which connection
 %% pool the MySQL dispatcher should use for querying database metadata.
 %% For more information, refer to your ErlyDB driver's documentation.
-%% 
+%%
 %% @spec compile(AppDir::string(), Options::[option()]) ->
 %%  {ok, Now::datetime()} | {error, Err}
 compile(AppDir, Options) ->
     erlyweb_compile:compile(AppDir, Options).
 
-
-%% @doc This is the out/1 function that Yaws calls when passing
-%%  HTTP requests to the ErlyWeb appmod.
-%%
-%% @spec out(A::yaws_arg()) -> ret_val()
-out(A) ->
-    AppName = get_app_name(A),
-    AppData = erlyweb_compile:get_app_data_module(AppName),
-    AppController =
-	case catch AppData:get_controller() of
-	    {'EXIT', {undef, _}} ->
-		exit({no_application_data,
-		      "Did you forget to call erlyweb:compile(AppDir) "
-		      "or add the app's previously compiled .beam "
-		      "files to the Erlang code path?"});
-	    Other1 ->
-		Other1
-	end,
-    case AppData:auto_compile() of
-	false -> ok;
-	{true, Options} ->
-	    auto_compile(A, AppData, Options)
-    end,
-
-    out(yaws_arg:add_to_opaque(
-	  A, {app_data_module, AppData}), AppController).
-
-%% @doc This function is useful for embedding the result of a 'phased'
-%% ErlyWeb rendering in an ErlyWeb component from the same application,
-%% but using a different app controller.
-%%
-%% This function was originally designed to simplify Facebook app development
-%% with ErlyWeb using Erlang2Facebook
-%% (http://code.google.com/p/erlang2facebook).
-%% In erlang2facebook, the fb_canvas component intercepts requests
-%% from Facebook and authenticates them. After authentication, it may be
-%% useful to start a new ErlyWeb "flow" using an alternative app controller
-%% and display the result in of this flow the output of fb_canvas.
-%%
-%% @spec out(A::arg(), AppController::atom()) -> term()
-out(A, AppController) ->
-    AppData = proplists:get_value(app_data_module, yaws_arg:opaque(A)),
-    handle_request(A,
-		   AppController, AppController:hook(A),
-		   AppData).
-
 %% checks that at least 3 seconds have passed since the last compilation
 %% and that the request doesn't match the optional auto_compile_exclude
 %% value.
@@ -203,8 +157,8 @@
     if Now > Last + 3 ->
 	case lists:keysearch(auto_compile_exclude, 1,
 			     Options) of
-	    {value, {_, Val}} -> 
-		case string:str(yaws_arg:appmoddata(A),
+	    {value, {_, Val}} ->
+		case string:str(erlyweb_arg:appmoddata(A),
 				Val) of
 		    1 -> ok;
 		    _ -> auto_compile1(AppData, Options)
@@ -222,6 +176,33 @@
         Err -> exit(Err)
     end.
 
+prepare_request(A) ->
+    AppName = get_app_name(A),
+    AppData = erlyweb_compile:get_app_data_module(AppName),
+    AppController =
+	case catch AppData:get_controller() of
+	    {'EXIT', {undef, _}} ->
+		exit({no_application_data,
+		      "Did you forget to call erlyweb:compile(AppDir) "
+		      "or add the app's previously compiled .beam "
+		      "files to the Erlang code path?"});
+	    Other1 ->
+		Other1
+	end,
+    case AppData:auto_compile() of
+	false -> ok;
+	{true, Options} ->
+	    auto_compile(A, AppData, Options)
+    end,
+    A2 = erlyweb_arg:app_data(A,AppData),
+    A3 = erlyweb_arg:app_controller(A2,AppController),
+    { A3 , AppController , AppData }.
+
+handle_request(A,AppController,AppData) ->
+    handle_request(A,
+		   AppController, AppController:hook(A),
+		   AppData).
+
 handle_request(A,
 	       AppController,
 	       {phased, Ewc, Func}, AppData) ->
@@ -243,14 +224,14 @@
       AppController,
       Ewc1, Rest, AppData,
       %% ignore the phased vars if the response isn't rendered in 2 phases
-      fun(Data, _PhasedVars) -> 
+      fun(Data, _PhasedVars) ->
 	      Data
       end).
 
 handle_request(_A, _AppController, undefined, Rest, _AppData,
 	       _PostRenderFun) ->
     Rest;
-handle_request(A, AppController, Ewc, Rest, AppData, PostRenderFun) -> 
+handle_request(A, AppController, Ewc, Rest, AppData, PostRenderFun) ->
     case catch ewc(Ewc, AppData) of
 	{response, Elems} ->
 	    {[PhasedVarsElems], OtherElems} =
@@ -260,9 +241,9 @@
 			     phased_vars, PhasedVarsElems)),
 	    Rest ++
 		lists:map(
-		  fun({rendered, Data}) -> 
+		  fun({rendered, Data}) ->
 			  {html, PostRenderFun(Data, PhasedVars)};
-		     ({rendered, MimeType, Data}) -> 
+		     ({rendered, MimeType, Data}) ->
 			  {content, MimeType,
 			   PostRenderFun(Data, PhasedVars)};
 		     (Other) ->
@@ -317,7 +298,7 @@
     element(1, get_initial_ewc1(Ewc)).
 
 get_initial_ewc1({ewc, A} = Ewc) ->
-    AppData = lookup_app_data_module(A),
+    AppData = erlyweb_arg:app_data(A),
     get_initial_ewc1(Ewc, AppData).
 get_initial_ewc1({ewc, A}, AppData) ->
     case get_ewc(A, AppData) of
@@ -344,8 +325,8 @@
     end;
 get_initial_ewc1(Ewc, _AppData) -> {Ewc, []}.
 
-    
 
+
 %% Process a controller function's return value
 ewc(Ewcs, AppData) when is_list(Ewcs) ->
     Rendered = [render_subcomponent(Ewc, AppData) || Ewc <- Ewcs],
@@ -372,7 +353,7 @@
 
 ewc({ewc, Controller, View, FuncName, [A | _] = Params}, AppData) ->
     {FuncName1, Params1} = Controller:before_call(FuncName, Params),
-    Response = apply(Controller, FuncName1, Params1),    
+    Response = apply(Controller, FuncName1, Params1),
     Response1 = Controller:before_return(FuncName1, Params1, Response),
     case Response1 of
 	({replace, Ewc})  when is_tuple(Ewc), element(1, Ewc) ==
@@ -449,7 +430,7 @@
 		Controller:after_render(FuncName, Params, Rendered),
 		Rendered
 	end,
-    Elems3 = lists:map( 
+    Elems3 = lists:map(
 	       fun({body, Ewc}) ->
 		       {rendered, RenderFun(Ewc)};
 		  ({body, MimeType, Ewc}) ->
@@ -472,7 +453,7 @@
     end.
 
 get_ewc(A) ->
-    get_ewc(A, lookup_app_data_module(A)).
+    get_ewc(A, erlyweb_arg:app_data(A)).
 
 get_ewc(A, AppData) ->
     Prefix = erlyweb_util:get_url_prefix(A),
@@ -492,7 +473,7 @@
 	{error, no_such_component} ->
 	    %% if the request doesn't match a controller's name,
 	    %% redirect it to /path
-	    Path = case yaws_arg:appmoddata(A) of
+	    Path = case erlyweb_arg:appmoddata(A) of
 		       [$/ | _ ] = P -> P;
 		       Other -> [$/ | Other]
 		   end,
@@ -503,12 +484,12 @@
 	    Component
     end.
 
-%% @doc Get the name for the application as specified in the opaque 
+%% @doc Get the name for the application as specified in the opaque
 %% 'appname' field in the YAWS configuration.
 %%
 %% @spec get_app_name(A::arg()) -> AppName::string() | exit(Err)
 get_app_name(A) ->
-    case proplists:get_value("appname", yaws_arg:opaque(A)) of
+    case erlyweb_arg:appname(A) of
 	undefined ->
 	    exit({missing_appname,
 		  "Did you forget to add the 'appname = [name]' "
@@ -519,18 +500,15 @@
 
 
 %% @doc Get the relative URL for the application's root path.
-%% 
 %%
+%%
 %% @spec get_app_root(A::arg()) -> string()
 get_app_root(A) ->
-    ServerPath = yaws_arg:server_path(A),
+    ServerPath = erlyweb_arg:server_path(A),
     {First, _Rest} =
 	lists:split(
 	  length(ServerPath) -
-	  length(yaws_arg:appmoddata(A)),
+	  length(erlyweb_arg:appmoddata(A)),
 	  ServerPath),
     First.
 
-lookup_app_data_module(A) ->
-    proplists:get_value(app_data_module, yaws_arg:opaque(A)).
-
Index: src/erlyweb/erlyweb_interface_yaws.erl
===================================================================
--- src/erlyweb/erlyweb_interface_yaws.erl	(revision 0)
+++ src/erlyweb/erlyweb_interface_yaws.erl	(revision 0)
@@ -0,0 +1,8 @@
+-module(erlyweb_interface_yaws).
+-export([out/1]).
+
+out(A) ->
+    Arg = erlyweb_arg:create(erlyweb_arg_yaws,A),
+    { Arg2 , AppController , AppData } = erlyweb:prepare_request(Arg),
+    erlyweb:handle_request(Arg2,AppController,AppData).
+
Index: src/erlyweb/erlyweb_arg_ewgi.erl
===================================================================
--- src/erlyweb/erlyweb_arg_ewgi.erl	(revision 0)
+++ src/erlyweb/erlyweb_arg_ewgi.erl	(revision 0)
@@ -0,0 +1,20 @@
+-module(erlyweb_arg_ewgi).
+-export([create/1,appmoddata/1,server_path/1,method/1,parse_post/1]).
+
+create(Env) ->
+    erlyweb_arg:create(?MODULE,Env).
+appmoddata(Env) ->
+    get_opaque_value(appmoddata,Env).
+server_path(Env) ->
+    get_opaque_value(server_path,Env).
+method(Env) ->
+    ewgi_api:method(Env).
+parse_post(Env) ->
+    ewgi_api:parse_post(Env).
+
+get_opaque_value(Key,Env) ->
+    case proplists:get_value(opaque,Env) of
+        undefined -> undefined;
+        Val       -> proplists:get_value(Key,Val)
+    end.
+
