public boolean insert(String s, State data) {
        
        TrieNode current = root;
        if (s.length() == 0) //For an empty character
        {
            if (!current.isMarker()) {
                current.setMarker(true);
            } else {
                return false;
            }

        }
        for (int i = 0; i < s.length(); i++) {
            TrieNode child = current.subNode(s.charAt(i));
            if (child != null) {
                current = child;
            } else {
                current.getChild().add(new TrieNode(s.charAt(i)));
                current = current.subNode(s.charAt(i));
            }
            // Set marker to indicate end of the word
            if (i == s.length() - 1) {
                if (!current.isMarker()) {
                    current.setMarker(true);
                    current.setData(data);
                    current.setName(s);
                    current.setIDnode(count);
                    //data.setID(count);
                    count++;
                    return true;
                } else {
                    return false;
                }
            }
        }
        return false;
    }