private ArrayList<Block> findLeafNode(Block root) {
		ArrayList<Block> leafList = new ArrayList<Block>();
		Queue<Block> queue = new LinkedList<Block>();
		HashSet<Block> visited = new HashSet<Block>();
		queue.add(root);

		while (!queue.isEmpty()) {
			Block blk = queue.remove();
			if (blk == null || visited.contains(blk)) {
				continue;
			}
			if (blk.isLeaf()) {
				leafList.add(blk);
			} else if (blk.getNextBlock() != null && blk.getNextBlock().isBackEdgeFrom(blk)) {
				// stupid const loop
				leafList.add(blk.getNextBlock());
			}
			visited.add(blk);
			queue.add(blk.getNextBlock());
			queue.add(blk.getNegBranchBlock());
		}
		return leafList;
	}