anchor.diff:      #lvl{}    -> false
     end.
   
  -delete_tab(S,Lvl = #lvl{}) ->
  -  get_rid_of(Lvl,S#state.keep_db),
  -  true;
  -delete_tab(_,_) ->
  -  false.
  +delete_tab(S,Tab) ->
  +  case get_lvl(S,Tab) of
  +    undefined ->
  +      false;
  +    Lvl ->
  +      get_rid_of(Lvl,S#state.keep_db),
  +      delete_lvl(S,Lvl),
  +      true
  +  end.
   
   get_rid_of(Lvl,false) -> lvl_destroy(Lvl);
   get_rid_of(Lvl,true)  -> lvl_close(Lvl).
   
   siz(S) ->
  -  fold_lvl(S,fun(Lvl,O) -> [{Lvl#lvl.name,undefined}|O] end).
  +  case fold_lvl(S,fun(Lvl,O) -> [{tab_name(Lvl),tab_size(Lvl)}|O] end) of
  +    [] -> [];
  +    Tabs -> {Tabs}
  +  end.
  +
  +tab_name(Lvl) -> list_to_binary(Lvl#lvl.name).
  +
  +tab_size(Lvl) -> length(key_getter(Lvl)).
   
   key_getter(Lvl) ->
     Iter = lvl_iter(Lvl,keys_only),
  
positive.code: get_lvl(S,Tab) ->
    case ets:lookup(S#state.tabs,Tab) of
      [Lvl=#lvl{}]  -> Lvl;
      []            -> throw({404,no_such_table})
    end.
  
  fold_lvl(S,Fun) ->
    ets:foldl(Fun,[],S#state.tabs).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% leveldb API
  
negative.code:       via(Lvl1,[],Lvl2,Key2,false);
      end_of_table ->
        throw({409,end_of_table});
      {NextKey,NextVal} ->
        ins_overwrite(Lvl2,Key2,NextKey),
        {[{NextKey,NextVal}]}
    end.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% handle the table of tables
  
  create_lvl() ->
    ets:new(rets_leveldb_tabs,[named_table,ordered_set,{keypos,2}]).
  
  delete_lvl(S,Lvl) ->
    ets:delete(S#state.tabs,Lvl#lvl.name).
  
  put_lvl(S,Lvl) ->
    ets:insert(S#state.tabs,Lvl).
  