public void add(String documentName, String word) {
        //adds a new term or inc frequency if it already exists in BST
        Term term = new Term(documentName, word);
        BSTNode node = new BSTNode(term);
        BSTNode current = root;
        boolean added = false;
        //System.out.println("\nAdding term: " + word);
        if (current == null) {
            //System.out.println("Replaced root");
            root = node;
            count++;
            added= true;
        }

        while (!added) {
            if (current.getTerm().getName().compareTo(node.getTerm().getName()) == 0) {
                //Equal
                //System.out.println("Equal terms, adding occurrence");
                current.getTerm().addNewOccurrence(documentName);
                added = true;
            } else if (current.getTerm().getName().compareTo(node.getTerm().getName()) > 0) {
                //go left
                if (current.getLeft() != null) {
                    current = current.getLeft();
                    //System.out.println("Going left");
                }
                else {
                    //System.out.println("Adding left node");
                    current.setLeft(node);
                    count++;
                    added = true;
                }
            } else if (current.getTerm().getName().compareTo(node.getTerm().getName()) < 0) {
                //go right
                if (current.getRight() != null) {
                    current = current.getRight();
                    //System.out.println("Going right");
                }
                else {
                    //System.out.println("Adding right node");
                    current.setRight(node);
                    count++;
                    added = true;
                }
            }
        }
    }