code: int insertPath(int geometry, int before_path) {
  		int prev = -1;
  
  		if (before_path != -1) {
  			if (geometry != getGeometryFromPath(before_path))
  				throw GeometryException.GeometryInternalError();
  
  			prev = getPrevPath(before_path);
  		} else
  			prev = getLastPath(geometry);
  
  		int newpath = newPath_(geometry);
  		if (before_path != -1)
  			setPrevPath_(before_path, newpath);
  
  		setNextPath_(newpath, before_path);
  		setPrevPath_(newpath, prev);
  		if (prev != -1)
  			setNextPath_(prev, newpath);
  		else
  			setFirstPath_(geometry, newpath);
  
  		if (before_path == -1)
  			setLastPath_(geometry, newpath);
  
  		setGeometryPathCount_(geometry, getPathCount(geometry) + 1);
  		return newpath;
  	}
docs: path at the end.