node mutateRecurse(node  nodeptr, doublePointer ratioptr , mutations newmuts, 
			double tree_age, double threshold, double loc)
	{
	  node mutatenode = null;
		
	  if (nodeptr.getDescendents()[0] != null) {
	    if (segFactory.segContains(nodeptr.getDescendents()[0].getSegment(), loc)) {
				
	      double temp = (double)(nodeptr.getGen() - nodeptr.getDescendents()[0].getGen())/ tree_age;
	      ratioptr.setDouble(ratioptr.getDouble()+temp);
				
	      if (ratioptr.getDouble() > threshold) {
	    	  newmuts.setAncNode1(nodeptr);
	    	  newmuts.setAncNode2(nodeptr.getDescendents()[0]);
	    	  return nodeptr.getDescendents()[0];
	      }
				
	      mutatenode = mutateRecurse (nodeptr.getDescendents()[0], 
					   ratioptr, 
					   newmuts, tree_age, 
					   threshold, loc);
	      if (mutatenode != null) return mutatenode;
	      /* this happens if we place a mutation inside this recursion. */
	    }
	  }	
	  else return null;


	  if ((nodeptr.getDescendents()[1]!= null) &&
	      (segFactory.segContains(nodeptr.getDescendents()[1].getSegment(), loc))) {
		  
	    double temp = (double) (nodeptr.getGen() 
				   - nodeptr.getDescendents()[1].getGen())
	      / tree_age;
	    ratioptr.setDouble(ratioptr.getDouble() + temp);
			
	    if (ratioptr.getDouble() > threshold) {
	      newmuts.setAncNode1(nodeptr);
	      newmuts.setAncNode2(nodeptr.getDescendents()[1]);
	      return nodeptr.getDescendents()[1];
	    }
	    mutatenode = mutateRecurse (nodeptr.getDescendents()[1], 
					 ratioptr,
					 newmuts, tree_age, 
					 threshold, loc);
	    if (mutatenode != null) return mutatenode;
	    /* this happens if we place a mutation inside this recursion. */
			
	  }
	  return null;
	}