Step file translator can't read subshapes

I'm working on a small application that translates STEP files to other file types. The problem is, some shapes have children but their respective label does not. I was creating functions iterating over labels, so that's a problem. I tried solving it in a few ways, but they were all a mess, so I'd appreciate some help. I was testing with the attached file called Combine_Harvester.STEP.

First, the code reads a STEP file, which is basically the one in openCascade's user guides:

Handle(TDocStd_Document) readFile(char* filename) {
    STEPCAFControl_Reader aReader;

    aReader.SetColorMode(true);
    aReader.SetLayerMode(true);
    aReader.SetNameMode(true);

    IFSelect_ReturnStatus aReadStat = aReader.ReadFile(filename);
    if (aReadStat != IFSelect_RetDone) { std::cout << "Error: couldn't read file \n"; }

    //Creates the TDocStd_Document, with it's usual parameters.
    Handle(TDocStd_Document) aDoc;
    Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
    BinXCAFDrivers::DefineFormat(anApp);
    XmlXCAFDrivers::DefineFormat(anApp);
    anApp->NewDocument("BinXCAF", aDoc);

    //Transfer the data from aReader to aDoc.
    if (!aReader.Transfer(aDoc)) {
        std::cout << "Cannot read any relevant data from the STEP file\n";
    }
    return aDoc;

}

After reading the file, I call the function translate file, that gets the Head of the assembly and builds the assembly tree over it, and the recursive function buildTree that builds the assembly tree:

void translateFile(Handle(TDocStd_Document) doc, char* filename) {
    //ITreeNode is the structure I'm translating the STEP file to
    ITreeNode* head;
    head->SetName(filename);

    Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(doc->Main());
    TDF_LabelSequence labels;
    myAssembly->GetFreeShapes(labels);

    //Iterates over the main shapes to build the node of the tree
    for (TDF_LabelSequence::Iterator aLabIter(labels); aLabIter.More(); aLabIter.Next()) {
        ITreeNode* children = node->GetChildren()->Emplace();
        buildTree(doc, children, aLabIter.Value());
    }
}

void buildTree(Handle(TDocStd_Document) doc, ITreeNode* parent, TDF_Label aLabel) {

    Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(doc->Main());
    Handle(XCAFDoc_ColorTool) myColor = XCAFDoc_DocumentTool::ColorTool(doc->Main());

    TopoDS_Shape shape;
    shape = myAssembly->GetShape(aLabel);
        //GetNameFromShape is an auxiliar function that either get the name of the shape or returns "UNNAMED_SHAPE" 
    parent->SetName(GetNameFromShape(shape, myAssembly));   

    float RGBcolors[4];
        //GetColorFromShape is an auxiliar function that either get the color of the shape or returns the default color.
    Quantity_ColorRGBA color = GetColorFromShape(shape, myAssembly);
    Quantity_Color rgb = color.GetRGB();
    RGBcolors[0] = rgb.Red();
    RGBcolors[1] = rgb.Blue();
    RGBcolors[2] = rgb.Green();
    RGBcolors[3] = color.Alpha();

        //translateShape gets the data from the shape to the Tree, it is working as intended. 
    translateShape(parent, shape, RGBcolors);

    for (TDF_ChildIterator cit(aLabel, true); cit.More(); cit.Next()) {
        ITreeNode* children = parent->GetChildren()->Emplace();
        buildTree(doc, children, cit.Value());
    }
}

The main problem is that, from what i've seen, the information on some shapes is divided between two labels. When I translate the STEP file this way, some shapes have subshapes but their labels don't have, so the buildTree() iteration stops before it should. The resulting tree from the file I gave looks something like in the attached image "Combine_Harvester_1.jpeg". If I change the line "myAssembly->GetFreeShapes(labels)" from the function translateFile() to "myAssembly->GetShapes()", the labels with the shapes and subshapes appear, but they are not under the Head node, as seen in the image "Combine_Harvester_2.jpeg". Looking at both images, it's possible to see that the figure "Kerangka ..." has no children when it is under "Combine_Harvester", but has two children when it has no parents. Is there a way to put all the children under "Combine_Harvester"?

Attachments: