anchor.diff:          return result;
         }
         Node parentNear = nearChild(createNode(current.parent), ray);
  -      if(current.index == parentNear.index){
  -        current = createNode(current.sibling);
  -        state = FROM_SIBLING;
  -      } else {
  -        current = createNode(current.parent);
  -        state = FROM_CHILD;
  -      }
  +      bool atNear = current.index == parentNear.index;
  +      current = createNode(atNear ? current.sibling : current.parent);
  +      state = atNear ? FROM_SIBLING : FROM_CHILD;
       } else {
         bool fromParent = state == FROM_PARENT;
         uint nextState = fromParent ? FROM_SIBLING : FROM_CHILD;
         float nextIndex = fromParent ? current.sibling : current.parent;
         if(rayBoxIntersect(current, ray) >= result.t){
  -        current = createNode(nextIndex);
  -        state = nextState;
  +        // missed box
         } else if (current.triangles > -1.0) {
  +        // at leaf
           processLeaf(current, ray, result);
  -        current = createNode(nextIndex);
  -        state = nextState;
         } else {
  -        current = nearChild(current, ray);
  -        state = FROM_PARENT;
  +        nextIndex = nearChildIndex(current, ray);
  +        nextState = FROM_PARENT;
         }
  +      current = createNode(nextIndex);
  +      state = nextState;
       }
     }
   }
  
positive.code: 	return weights.x * normals.n1 + weights.y * normals.n2 + weights.z * normals.n3;
  }
  
  Hit traverseTree(Ray ray){
    uint state = FROM_PARENT;
  	Hit result = Hit(max_t, -1.0);
  	Hit temp;
    Node current = nearChild(createNode(0.0), ray);
    while(true){
      if(state == FROM_CHILD){
  
negative.code:   return createNode(index);
  }
  
  float nearChildIndex(Node node, Ray ray){
    uint axis = uint(node.split);
    float index = ray.dir[axis] > 0.0 ? node.left : node.right;
    return index;
  }
  
  Node farChild(Node node, Ray ray){
    uint axis = uint(node.split);
    float index = ray.dir[axis] <= 0.0 ? node.left : node.right;
    return createNode(index);
  }
  
  float farChildIndex(Node node, Ray ray){
    uint axis = uint(node.split);
    float index = ray.dir[axis] <= 0.0 ? node.left : node.right;
    return index;
  }
  
  
  