private int checkGainRemove(Node removedFeature, TreeNode currentNode,
            Set<Integer> sampleList) {
        if (currentNode == null) {
            return 0;
        }

        if (currentNode.feature == null){
            if (currentNode.noCorrect != sampleList.size())
                unclassified.addAll(sampleList);
            return currentNode.noCorrect;
        }

        // if this is the feature we are looking for
        // then rebuild the subtree rooted here
        if (currentNode.feature.equals(removedFeature)) {
            treeNodeMap.remove(currentNode.feature.id);
            if (currentNode.parent != null) {
                // find all features that has already been used up in the tree
                Set<Node> previousUsedFeatures = new HashSet<Node>();
                currentNode.getpreviousUsedFeatures(previousUsedFeatures);

                // compute the new candidate list of the parent of currentNode
                Set<Node> candidates = new HashSet<Node>();
                for (Node n : previousUsedFeatures) {
                    candidates.addAll(n.neighbors);
                }
                candidates.retainAll(featureList);

                // choose a feature and split this node again
                TreeNode parent = currentNode.parent;
                int _noCorrect = 0;
                if (currentNode == parent.trueChild) {
                    parent.trueChild = null;
                    _noCorrect = splitTreeNode(parent, candidates, true);
                } else {
                    parent.falseChild = null;
                    _noCorrect = splitTreeNode(parent, candidates, false);
                }
                return _noCorrect;
            } else {    // current is root node, rebuild the whole tree
                return buildDecTree(sampleList);
            }
        } else {       // keep looking in two child
            // add currentNode feature to the usedFeatures list
            usedFeatures.add(currentNode.feature);
            insertIntoTreeNodeMap(treeNodeMap, currentNode);

            currentNode.noCorrect = 0;
            // cascade to children
            if (currentNode.trueChild != null) {
                currentNode.noCorrect += checkGainRemove(removedFeature, currentNode.trueChild, currentNode.sampleSetTrue);
            }
            if (currentNode.falseChild != null) {
                currentNode.noCorrect += checkGainRemove(removedFeature, currentNode.falseChild, currentNode.sampleSetFalse);
            }
            return currentNode.noCorrect;
        }
    }