private boolean removeInternal(Direction selection, boolean fetchFirst) throws PersistitException {
        assertCorrectThread(true);
        _persistit.checkClosed();

        if (selection != EQ && selection != GTEQ && selection != GT) {
            throw new IllegalArgumentException("Invalid mode " + selection);
        }

        int keySize = _key.getEncodedSize();

        _key.copyTo(_spareKey3);
        _key.copyTo(_spareKey4);

        // Special case for empty key
        if (keySize == 0) {
            if (selection == EQ) {
                return false;
            }
            _spareKey3.append(BEFORE);
            _spareKey4.append(AFTER);
        } else {
            if (selection == EQ) {
                _spareKey4.nudgeDeeper();
            } else if (selection == GT) {
                _spareKey3.nudgeDeeper();
                _spareKey4.nudgeRight();
            } else if (selection == GTEQ) {
                _spareKey4.nudgeRight();
            }
        }

        final boolean result = removeKeyRangeInternal(_spareKey3, _spareKey4, fetchFirst);
        _treeHolder.verifyReleased();
        return result;
    }