private int tabulateTrees(TreeReader reader,
			Map<String, TreeItem> clades) throws IOException {

		int countedTrees = 0;
		int examinedTrees =0;

		SunFishFrame.getSunFishFrame().setInfoLabelText("Parsing trees file");
		
		progressMonitor.setNote("Counting clades");
		progressMonitor.setProgress(0);
		DrawableTree tree = reader.getNextTree(); //This is the slow part and we do it for every single tree, regardless of subSampleRate
										//We should make a DelayedDrawableTree class that just reads in the string but doesn't do any parsing
										//or allocating until necessary.. this would probably be 100x faster
		
		while(tree!=null && countedTrees < maxTrees && (!cancel)) {
			examinedTrees++;
			//System.out.println("Examining tree #" + examinedTrees );
			if (tree!=null && (double)examinedTrees % subsampleRate == 0.0 && examinedTrees > burninTrees) {
				//System.out.println("Counting tree #" + examinedTrees + " val : " + (double)examinedTrees/subsampleRate );
				if (tree.getRoot().numOffspring()<2) {
					System.err.println("Error reading tree, found less than two two tips from root, not tabulating clades...");
				}
				else {
					if (DEBUG)
						System.out.println("Counting tree #" + examinedTrees);
					countClades(tree, (DrawableNode)tree.getRoot(), clades);
					countedTrees++;
				}
				

			}

			
			if (examinedTrees%25==0) {
				progressMonitor.setProgress((int)Math.round(95.0*(double)examinedTrees/(double)totalTreeEst));
				progressMonitor.setNote("Counting tree: " + examinedTrees + "/" + totalTreeEst);
			}
			tree = reader.getNextTree();
		}

		
		//System.out.println("Counted " + countedTrees + " of " + examinedTrees + " trees = " + (double)countedTrees/(double)examinedTrees + "%");
		return countedTrees;
	}