@Override
  public RedBlackTree.Node<T> insert(T value) {
    RedBlackTree.Node<T> result = super.insert(value);

    if (result != null) {
      Node<T> linkedNode = (Node<T>) result;
      Node<T> pred = (Node<T>) super.getPredecessor(result);
      linkedNode.setPredecessor(pred);
      if (pred != null) {
        pred.setSuccessor(linkedNode);
      }
      Node<T> succ = (Node<T>) super.getSuccessor(result);
      linkedNode.setSuccessor(succ);
      if (succ != null) {
        succ.setPredecessor(linkedNode);
      }

      if (head == null) {
        head = getRoot();
      } else {
        RedBlackTree.Node<T> node = getPredecessor(head);
        if (node != null) {
          head = node;
        }
      }
    }

    return result;
  }