public function remove($key)
{
$t = $this;
if ($this->isRoot() && !$this->isRed($this->left()) && !$this->isRed($this->right())) {
$t = $this->flipToRed($t);
}
$t = $this->removeIn($t, $key);
if (!$t->isEmpty()) {
$t = $this->flipToBlack($t);
}
return $t;
}