           for (int objectIndex = 0; objectIndex < activeObjectCount;
                objectIndex++)
           {
-            int currentObjectId = findLSB(remainingActiveObjects);
+            int currentObjectId = calculateNextObjectId(remainingActiveObjects);
             if (currentObjectId < 0)
               break;
-            remainingActiveObjects &= (~(1 << (currentObjectId)));
 
             float squareGradientLength = 0.0f;
 

      float segmentTextureLength = 0.0;
      for (int oi = 0; oi < activeObjectCount; oi++)
      {
        int currentObjectId = findLSB(remainingActiveObjects);
        remainingActiveObjects &= (~(1 << currentObjectId));

        vec4 textureStartPos = volumes[0].textureMatrix * inverseViewMatrix *
                               currentFragment.eyePos;

                              vec2(density, volumes[volumeId].transferFunctionRow));
}

int calculateNextObjectId(inout uint remainingActiveObjects)
{
  int currentObjectId = findLSB(remainingActiveObjects);
  remainingActiveObjects &= (~(1 << (currentObjectId)));

  return currentObjectId;
}

void main()
{
  o_PixColor = vec4(0);
