void BMEaddSpecies( node v, double[][] D, double[][] A) 
	{
		edge e; //loop variable
		edge e_min; //points to best edge seen thus far
		double w_min = 0.0;   //used to keep track of tree weights
 
		//initialize variables as necessary
 
		//CASE 1: T is empty, v is the first node
		if ( this.root == null )  
		{
			this.root = v;  
			//	note that we are rooting T arbitrarily at a leaf.  
			// T.root is not the phylogenetic root
			v.index = 0;
			this.size = 1;
			return;     
		}
		//CASE 2: T is a single-vertex tree
		if ( 1 == size )
		{
			v.index = 1;
			e = new edge( "E1", this.root, v, 0.0 );
			A[v.index][v.index] = D[v.index2][root.index2];
			root.leftEdge = v.parentEdge = e;
			size = 2;
			return; 
		}
		//CASE 3: T has at least two nodes and an edge.  Insert new node
		//by breaking one of the edges
		v.index = size;
		BMEcalcNewvAverages( v,D,A );
		/*calcNewvAverages will update A for the row and column 
   		include the node v.  Will do so using pre-existing averages in T and
   		information from A,D*/
		e_min = root.leftEdge;
		e = e_min.head.leftEdge;
		while ( null != e )
		{
			BMEtestEdge( e, v, A ); 
			/*testEdge tests weight of tree if loop variable 
			e is the edge split, places this value in the e.totalweight field */
			if (e.totalweight < w_min)
			{
				e_min = e;
				w_min = e.totalweight;
			}
			e = topFirstTraverse(e);
		}
		//e_min now points at the edge we want to split
		BMEsplitEdge( v, e_min, A );
	}