anchor.diff:  -define (STORAGE_SRV, bh_storage_srv).
   -define (TAB_ID_TO_BEE, 'id_to_bee_table').
   -define (TAB_PID_TO_BEE, 'port_to_bee_table').
  --define (TAB_NAME_TO_PATH, 'app_name_to_path_table').
   
   %%====================================================================
   %% API
  
positive.code: %%--------------------------------------------------------------------
  %%% Internal functions
  %%--------------------------------------------------------------------
  
  % Find and transfer the bee
  find_and_transfer_bee(App) ->
    Nodes = lists:map(fun(N) -> node(N) end, node_manager:get_storage()),
    Path = next_free_honeycomb(App),
    LocalPath = filename:join([filename:absname(""), lists:append([Path, "app.iso"])]),
    case find_bee_on_storage_nodes(App#app.name, Nodes) of
      {ok, Node, RemotePath} ->
        slugger:get(Node, RemotePath, LocalPath);
      {error, _} -> error
    end,
    {ok, Path, LocalPath}.
    
  find_bee_on_storage_nodes(_, []) -> {error, not_found};
  find_bee_on_storage_nodes(Name, [Node|Rest]) ->
    case rpc:call(Node, ?STORAGE_SRV, has_squashed_repos, [Name]) of
  
negative.code:     Path -> {ok, Node, Path}
    end.
  
  % Mount the bee
  mount_bee_from_path(App, ImagePath) ->
    Proplist = ?TEMPLATE_SHELL_SCRIPT_PARSED("mount-bee", [
      {"[[APP_NAME]]", App#app.name},
      {"[[BEE_IMAGE]]", ImagePath}
    ]),
    io:format("Mount bee: ~p~n", [Proplist]),
    case proplists:get_value(path, Proplist) of
      undefined -> {error, not_mounted};
      Path ->
        {ok, Path}
    end.
  
  % Start a new instance of the application
  run_application_on_port_in_path(App, Port, AppRootPath, From) ->  
    TemplateCommand = App#app.start_command,  
    RealCmd = string_utils:template_command_string(TemplateCommand, [
                                                          {"[[PORT]]", misc_utils:to_list(Port)}
                                                        ]),
    % START INSTANCE
    process_flag(trap_exit, true),
    
    io:format("new path, ~p~n", [AppRootPath]),
    AppPath = filename:join([AppRootPath, "home", "app"]),
    ?LOG(info, "Starting on port ~p as with ~p in ~p", [Port, RealCmd, AppPath]),
    
    Pid = port_handler:start(RealCmd, AppPath, self(), [nouse_stdio, {packet, 4}]),
    Host = host:myip(),
    Id = {App#app.name, Host, Port},
    
  