 
 
     } else if (flag0 && !flag1 && flag2) { // 3 new triangles have been spawned
-
-        if (numberOfKeptTriangles+triIdxOffs == 8233) {
-            printf("FLAG31\n");
-        }
-        if (numberOfKeptTriangles+triIdxOffs+1 == 8233) {
-            printf("FLAG32\n");
-        }
-        if (numberOfKeptTriangles+triIdxOffs+2 == 8233) {
-            printf("FLAG33\n");
-        }
 
         // Get index of neighbors of old triangle
         uint oldN0 = oldTriangleNeighbors_D[3*idx+0];

                 u1 = newTriangles_D[3*(newTriangleIdxOffsets[oldN0]+i)+1];
                 u2 = newTriangles_D[3*(newTriangleIdxOffsets[oldN0]+i)+2];
                 if (hasAdjEdge_D (w0, w1, w2, u0, u1, u2)) {
                     newTriangleNeighbors_D[3*(numberOfKeptTriangles+triIdxOffs)+3]=
                             numberOfKeptTriangles + newTriangleIdxOffsets[oldN0]+i;
                 }
             }
         } else {
             newTriangleNeighbors_D[3*(numberOfKeptTriangles+triIdxOffs)+3]=
                     oldTriangleIdxOffset[oldN0];
         }

         // This neighbor is the middle subdivision
         newTriangleNeighbors_D[3*(numberOfKeptTriangles+triIdxOffs)+4] =
                 numberOfKeptTriangles+triIdxOffs + 3;

         // This neighbor has to be determined by comparing vertex indices
         uint subDivCntN1 = subdivCnt_D[oldN1];
         if (subDivCntN1 > 0) {
             for (int i = 0; i < subDivCntN1; ++i) {
                 uint u0, u1, u2;


        // Get respective vertex indices of this triangle
        uint w0 = v0;
        uint w1 = vNew0;
        uint w2 = v2;

        // This neighbor has to be determined by comparing vertex indices
        uint subDivCntN0 = subdivCnt_D[oldN0];
        if (subDivCntN0 > 0) {
            for (int i = 0; i < subDivCntN0; ++i) {
                uint u0, u1, u2;
                u0 = newTriangles_D[3*(newTriangleIdxOffsets[oldN0]+i)+0];
                u1 = newTriangles_D[3*(newTriangleIdxOffsets[oldN0]+i)+1];
                u2 = newTriangles_D[3*(newTriangleIdxOffsets[oldN0]+i)+2];
                if (hasAdjEdge_D (w0, w1, w2, u0, u1, u2)) {
                    newTriangleNeighbors_D[3*(numberOfKeptTriangles+triIdxOffs)+0]=
                            numberOfKeptTriangles + newTriangleIdxOffsets[oldN0]+i;
                }
            }
        } else {
            newTriangleNeighbors_D[3*(numberOfKeptTriangles+triIdxOffs)+0]=
                    oldTriangleIdxOffset[oldN0];
        }

        // This neighbor is the other subdivision
        newTriangleNeighbors_D[3*(numberOfKeptTriangles+triIdxOffs)+1] =
                numberOfKeptTriangles+triIdxOffs+1;

        // This neighbor has to be determined by comparing vertex indices
        uint subDivCntN2 = subdivCnt_D[oldN2];
