anchor.diff:      _Else -> 1
     end.
     
  -execute_request(RackInstance, Parameters) ->
  +execute_request(InstanceManager, Parameters) ->
     Request = [http_request , pure | prepare_parameters(Parameters)],
  -  RackInstance ! {self(), {request, Request}},
  +  InstanceManager ! {self(), {request, Request}},
     receive
       {_Source, {result, Result}} -> result_processor(Result);
       {_Source, {error, Result}} ->
  
positive.code: 
  start(SConf) ->
      RequestPoolSize = list_to_integer(proplists:get_value("request_pool_size", SConf#sconf.opaque, 10)),
      SlowRequestPoolSize = list_to_integer(proplists:get_value("slow_request_pool_size", SConf#sconf.opaque, 10)),
  	RailsEnv = proplists:get_value("rails_env", SConf#sconf.opaque, "production"),
  
      %%Get the rack application location
  
negative.code: 
  	%% Create a process group for the normal request pool
  	pg2:create(normal_pool),
  	%% Create a process group for the backup request pool
  	pg2:create(backup_pyool),
  
      %%Start rack application instances for the normal request pool 
      Cmd = lists:flatten(io_lib:format("bundle exec \"ruby ./ruby/src/rack_instance.rb -r ~s -e ~s\"", [AppRoot, RailsEnv])),
  	[spawn(?MODULE, instance_manager, [AppRoot, RailsEnv, Cmd, normal_pool]) || _ <- lists:seq(1, RequestPoolSize)],
      %%Start rack application instances for the backup request pool 
  	Cmd = lists:flatten(io_lib:format("bundle exec \"ruby ./ruby/src/rack_instance.rb -r ~s -e ~s\"", [AppRoot, RailsEnv])),
  	[spawn(?MODULE, instance_manager, [AppRoot, RailsEnv, Cmd, normal_pool]) || _ <- lists:seq(1, BackupRequestPoolSize)],
      ok.
  
  init_instance_manager(AppRoot, RailsEnv, Cmd, RequestPool) ->
  	%% Spawn a process to run the rack instance
  	RackPid = spawn_ruby_instance(AppRoot, RailsEnv, Cmd, RequestPool),
  	%% Join the rack instance manager to the process group
  	case pg2:join(RequestPool, self()) of
  		{error, Error} ->
  			io:format("Error occurred trying to join process group: ~p~n", [Error]);
  		_ ->
  			ok
  	end,
  
  	%% Begin instance manager loop
  	instance_manager_loop(RackPid, {free, []}).
  	
  spawn_ruby_instance(AppRoot, RailsEnv, Cmd, RequestPool) ->
      spawn(fun() ->
        process_flag(trap_exit, true),
        Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]),
        port_loop(Port, 10000, "cmd")
      end).
  
  
  %% TODO: Handle reply from rack instance.
  %% TODO: Handle moving backed up requests off  list
  %% TODO: Handle using rack instance from backup pool 
  %%		 if request waits for too long.
  instance_manager_loop(RackPid, {free, []}) ->
  	receive
  		{Source, {request, Req}} -> 
  			RackPid ! {self(), {request, Req}}
  	end;
  instance_manager_loop(RackPid, {busy, []}) ->
  	receive
  		{Source, {request, Req}} -> 
  			instance_manager_loop(RackPid, [{busy, {Source, {request, Req}}}])
  	end;
  instance_manager_loop(rackpid, {free, requestlist}) ->
  	receive
  		{source, {request, req}} -> 
  			instance_manager_loop(rackpid, [{busy, {source, {request, req}}}| requestlist])
  	end.
  
  port_loop(Port, Timeout, Command) ->
    receive
  