public function add_terminal($name, $label, $callback = null)
    {
        if ($label === null || $callback === null) {
            unset($this->terminal_labels[$name], $this->terminals[$name]);
        } elseif (!in_array($label, $this->terminal_labels)) {
            $this->terminals[$name] = $callback;
            $this->terminal_labels[$name] = $label;
            asort($this->terminal_labels);
        }

        return $this;
    }