docs: public static Deferred<Branch> fetchBranch(final TSDB tsdb, 
        final byte[] branch_id, final boolean load_leaf_uids) {
      
      final Deferred<Branch> result = new Deferred<Branch>();
      final Scanner scanner = setupBranchScanner(tsdb, branch_id);
      
      // This is the branch that will be loaded with data from the scanner and
      // returned at the end of the process.
      final Branch branch = new Branch();
      
      // A list of deferreds to wait on for child leaf processing
      final ArrayList<Deferred<Object>> leaf_group = 
        new ArrayList<Deferred<Object>>();
      
      /**
       * Exception handler to catch leaves with an invalid UID name due to a 
       * possible deletion. This will allow the scanner to keep loading valid
       * leaves and ignore problems. The fsck tool can be used to clean up
       * orphaned leaves. If we catch something other than an NSU, it will
       * re-throw the exception
       */
      final class LeafErrBack implements Callback<Object, Exception> {
  
        final byte[] qualifier;
        
        public LeafErrBack(final byte[] qualifier) {
          this.qualifier = qualifier;
        }
        
        @Override
        public Object call(final Exception e) throws Exception {
          Throwable ex = e;
          while (ex.getClass().equals(DeferredGroupException.class)) {
            ex = ex.getCause();
          }
          if (ex.getClass().equals(NoSuchUniqueId.class)) {
            LOG.debug("Invalid UID for leaf: " + idToString(qualifier) + 
                " in branch: " + idToString(branch_id), ex);
          } else {
            throw (Exception)ex;
          }
          return null;
        }
        
      }
      
      /**
       * Called after a leaf has been loaded successfully and adds the leaf
       * to the branch's leaf set. Also lazily initializes the leaf set if it 
       * hasn't been.
       */
      final class LeafCB implements Callback<Object, Leaf> {
  
        @Override
        public Object call(final Leaf leaf) throws Exception {
          if (leaf != null) {
            if (branch.leaves == null) {
              branch.leaves = new HashMap<Integer, Leaf>();
            }
            branch.leaves.put(leaf.hashCode(), leaf); 
          }
          return null;
        }
        
      }
      
      /**
       * Scanner callback executed recursively each time we get a set of data
       * from storage. This is responsible for determining what columns are 
       * returned and issuing requests to load leaf objects.
       * When the scanner returns a null set of rows, the method initiates the
       * final callback.
       */
      final class FetchBranchCB implements Callback<Object, 
        ArrayList<ArrayList<KeyValue>>> {
    
        /**
         * Starts the scanner and is called recursively to fetch the next set of
         * rows from the scanner.
         * @return The branch if loaded successfully, null if the branch was not
         * found.
         */
        public Object fetchBranch() {
          return scanner.nextRows().addCallback(this);
        }
        
        /**
         * Loops through each row of the scanner results and parses out branch
         * definitions and child leaves.
         * @return The final branch callback if the scanner returns a null set
         */
        @Override
        public Object call(final ArrayList<ArrayList<KeyValue>> rows)
            throws Exception {
          if (rows == null) {
            if (branch.tree_id < 1 || branch.path == null) {
              result.callback(null);
            } else {
              result.callback(branch);
            }
            return null;
          }
          
          for (final ArrayList<KeyValue> row : rows) {
            for (KeyValue column : row) {
  
              // matched a branch column
              if (Bytes.equals(BRANCH_QUALIFIER, column.qualifier())) {
                if (Bytes.equals(branch_id, column.key())) {
                  
                  // it's *this* branch. We deserialize to a new object and copy
                  // since the columns could be in any order and we may get a 
                  // leaf before the branch
                  final Branch local_branch = JSON.parseToObject(column.value(), 
                      Branch.class);
                  branch.path = local_branch.path;
                  branch.display_name = local_branch.display_name;
                  branch.tree_id = Tree.bytesToId(column.key());
  
                } else {
                  // it's a child branch
                  final Branch child = JSON.parseToObject(column.value(), 
                      Branch.class);
                  child.tree_id = Tree.bytesToId(column.key());
                  branch.addChild(child);
                }
              // parse out a leaf
              } else if (Bytes.memcmp(Leaf.LEAF_PREFIX(), column.qualifier(), 0, 
                  Leaf.LEAF_PREFIX().length) == 0) {
                if (Bytes.equals(branch_id, column.key())) {
                  // process a leaf and skip if the UIDs for the TSUID can't be 
                  // found. Add an errback to catch NoSuchUniqueId exceptions
                  leaf_group.add(Leaf.parseFromStorage(tsdb, column, 
                      load_leaf_uids)
                      .addCallbacks(new LeafCB(), 
                          new LeafErrBack(column.qualifier())));
                } else {
                  // TODO - figure out an efficient way to increment a counter in 
                  // the child branch with the # of leaves it has
                }
              }
            }
          }
          
          // recursively call ourself to fetch more results from the scanner
          return fetchBranch();
        }      
      }
      
      // start scanning
      new FetchBranchCB().fetchBranch();
      return result;
    }