code: function() {
  
      var elemTree = {};
  
      function findPath( parents) {
  
        if (!parents || parents.length == 0) return parents;
  
        var el = loadedElems[ parents[0] ];
  
        if (el && el.extend.length > 0) {
          return findPath( el.extend.concat( parents ) );
        } else {
          return parents;
        }
      }
  
      function getParent( parents, target, depth ) {
        for (var i=0; i<parents.length; i++) {
          if ( target[ parents[i] ] ) {
            return getParent( parents, target[ parents[i] ], depth+1 );
          }
          if (depth > 20) {
            return target;
          }
        }
        return target;
      }
  
      // Sort by depth of inheritance
      var sortedLevels = [];
      for (var k in loadedElems ) {
        loadedElems[k].extend = findPath( loadedElems[k].extend );
        sortedLevels.push( loadedElems[k] );
      }
  
      sortedLevels.sort( function(a,b) {
        var i = (a.name > b.name) ? 0.1 : -0.1;
        var ai = a.extend.length;
        var bi = b.extend.length;
        if (a.name=="Space") ai = -100;
        if (a.name=="Form") ai = -99;
        if (a.name=="Point") ai = -98;
        if (b.name=="Space") bi = -100;
        if (b.name=="Form") bi = -99;
        if (b.name=="Point") bi = -98;
  
        return (ai - bi) + i;
      });
  
      // Compose inheritance tree
      for (var i=0; i<sortedLevels.length; i++) {
        var c = sortedLevels[i];
  
        if (c.extend.length == 0) {
          elemTree[ c.name ] = {}
        } else {
          var parent = getParent(c.extend, elemTree, 0);
          parent[ c.name ] = {};
        }
      }
  
      return elemTree;
  
    }
docs: load elements