public function end() {
        // First unset the reference so it doesn't overwrite the original where clause.
        unset($this->currentWhere);

        // Move the pointer in the where stack back one level.
        if (empty($this->whereStack)) {
            trigger_error("Call to Query->end() without a corresponding call to Query->begin*().", E_USER_NOTICE);
            $this->currentWhere = &$this->where;
        } else {
            $key = key(end($this->whereStack));
            $this->currentWhere = &$this->whereStack[$key];
            unset($this->whereStack[$key]);

        }
        return $this;
    }