bool dwgReader18::readDwgClasses(){
    DRW_DBG("\ndwgReader18::readDwgClasses\n");
    dwgSectionInfo si = sections[secEnum::CLASSES];
    if (si.Id < 0) //not found, ends
        return false;
    if (!parseDataPage(si/*, objData*/)) {
        return false;
    }

    //global store for uncompressed data of all pages
    uncompSize=si.size;
    dwgBuffer dataBuf(objData.get(), uncompSize, &decoder);

    DRW_DBG("classes section sentinel= ");
    checkSentinel(&dataBuf, secEnum::CLASSES, true);

    duint32 size = dataBuf.getRawLong32();
    DRW_DBG("\ndata size in bytes "); DRW_DBG(size);
    if (((version == DRW::AC1021 || version == DRW::AC1027 ) && maintenanceVersion > 3) || version >= DRW::AC1032 ) { //2010+
        duint32 hSize = dataBuf.getRawLong32();
        DRW_DBG("\n2010+ & MV> 3, height 32b: "); DRW_DBG(hSize);
    }
    duint32 bitSize = 0;
    if (version > DRW::AC1021) {//2007+
        bitSize = dataBuf.getRawLong32();
        DRW_DBG("\ntotal size in bits "); DRW_DBG(bitSize);
    }
    duint32 maxClassNum = dataBuf.getBitShort();
    DRW_DBG("\nMaximum class number "); DRW_DBG(maxClassNum);
    DRW_DBG("\nRc 1 "); DRW_DBG(dataBuf.getRawChar8());
    DRW_DBG("\nRc 2 "); DRW_DBG(dataBuf.getRawChar8());
    DRW_DBG("\nBit "); DRW_DBG(dataBuf.getBit());

    /*******************************/
    dwgBuffer *strBuf = &dataBuf;
    dwgBuffer strBuff(objData.get(), uncompSize, &decoder);
    //prepare string stream for 2007+
    if (version > DRW::AC1021) {//2007+
        strBuf = &strBuff;
        duint32 strStartPos = bitSize+191;//size in bits + 24 bytes (sn+size+hSize) - 1 bit (endbit)
        DRW_DBG("\nstrStartPos: "); DRW_DBG(strStartPos);
        strBuff.setPosition(strStartPos >> 3);
        strBuff.setBitPos(strStartPos & 7);
        DRW_DBG("\nclasses strings buff.getPosition: "); DRW_DBG(strBuff.getPosition());
        DRW_DBG("\nclasses strings buff.getBitPos: "); DRW_DBG(strBuff.getBitPos());
        DRW_DBG("\nendBit "); DRW_DBG(strBuff.getBit());
        strStartPos -= 16;//decrement 16 bits
        DRW_DBG("\nstrStartPos: "); DRW_DBG(strStartPos);
        strBuff.setPosition(strStartPos >> 3);
        strBuff.setBitPos(strStartPos & 7);
        DRW_DBG("\nclasses strings buff.getPosition: "); DRW_DBG(strBuff.getPosition());
        DRW_DBG("\nclasses strings buff.getBitPos: "); DRW_DBG(strBuff.getBitPos());
        duint32 strDataSize = strBuff.getRawShort16();
        DRW_DBG("\nstrDataSize: "); DRW_DBG(strDataSize);
        if (strDataSize & 0x8000) {
            strStartPos -= 16;//decrement 16 bits
            strDataSize &= 0x7FFF; //strip 0x8000;
            strBuff.setPosition(strStartPos >> 3);
            strBuff.setBitPos(strStartPos & 7);
            duint32 hiSize = strBuff.getRawShort16();
            strDataSize |= (hiSize << 15);
        }
        strStartPos -= strDataSize;
        DRW_DBG("\nstrStartPos: "); DRW_DBG(strStartPos);
        strBuff.setPosition(strStartPos >> 3);
        strBuff.setBitPos(strStartPos & 7);
        DRW_DBG("\nclasses strings buff.getPosition: "); DRW_DBG(strBuff.getPosition());
        DRW_DBG("\nclasses strings buff.getBitPos: "); DRW_DBG(strBuff.getBitPos());
    }

    /*******************************/

    duint32 endDataPos = maxClassNum-499;
    DRW_DBG("\nbuff.getPosition: "); DRW_DBG(dataBuf.getPosition());
    for (duint32 i= 0; i<endDataPos;i++) {
        DRW_Class *cl = new DRW_Class();
        cl->parseDwg(version, &dataBuf, strBuf);
        classesmap[cl->classNum] = cl;
        DRW_DBG("\nbuff.getPosition: "); DRW_DBG(dataBuf.getPosition());
    }
    DRW_DBG("\nend classes data buff.getPosition: "); DRW_DBG(dataBuf.getPosition());
    DRW_DBG("\nend classes data buff.getBitPos: "); DRW_DBG(dataBuf.getBitPos());
    DRW_DBG("\nend classes strings buff.getPosition: "); DRW_DBG(strBuf->getPosition());
    DRW_DBG("\nend classes strings buff.getBitPos: "); DRW_DBG(strBuf->getBitPos());

/***************/

    strBuf->setPosition(strBuf->getPosition()+1);//skip remaining bits
    DRW_DBG("\nCRC: "); DRW_DBGH(strBuf->getRawShort16());
    if (version > DRW::AC1018){
        DRW_DBG("\nunknown CRC: "); DRW_DBGH(strBuf->getRawShort16());
    }
    DRW_DBG("\nclasses section end sentinel= ");
    checkSentinel(strBuf, secEnum::CLASSES, false);

    //Cleanup: global store for uncompressed data of all pages
    objData.reset();

    return strBuf->isGood();
}