code: private void expandDeferredFinalStates(Deque<DetElement> finalQueue) {
      HashBiMap<Integer, GallicWeight> outputStateIdToFinalSuffix = HashBiMap.create();
      while (!finalQueue.isEmpty()) {
        DetElement element = finalQueue.removeFirst();
        for (GallicWeight gallicWeight : element.residual.getWeights()) {
          // factorization is like a simple version of the divisor/divide calculation earlier
          Pair<GallicWeight, GallicWeight> factorized = gallicSemiring.factorize(gallicWeight);
          GallicWeight prefix = factorized.getLeft();
          GallicWeight suffix = factorized.getRight();
          if (!outputStateIdToFinalSuffix.inverse().containsKey(suffix)) {
            // we don't have a synthetic state for this suffix yet
            MutableState newOutputState = outputFst.newState();
            outputStateIdToFinalSuffix.put(newOutputState.getId(), suffix);
            if (suffix.getLabels().isEmpty()) {
              // this suffix is a real final state, and there's no more work to do
              newOutputState.setFinalWeight(suffix.getWeight());
            } else {
              // this suffix still has more labels to emit, so leave final weight as zero and enqueue for expansion
              finalQueue.addLast(new DetElement(newOutputState.getId(), suffix));
            }
          }
          Integer outputStateId = outputStateIdToFinalSuffix.inverse().get(suffix);
          MutableState nextState = checkNotNull(outputFst.getState(outputStateId), "state should exist", outputStateId);
          MutableState thisState = checkNotNull(outputFst.getState(element.inputStateId));
          Preconditions.checkArgument(prefix.getLabels().size() == 1, "prefix size should be 1", prefix);
          int oLabel = prefix.getLabels().get(0);
          // note that openfst has an 'increment subsequent epsilons' feature so that these paths can still be
          // guarenteed to be deterministic (with just multiple definitions of <EPS>; this feature would go here
          // if we decide to implement it in the future
          outputFst.addArc(thisState, this.outputEps, oLabel, nextState, prefix.getWeight());
        }
      }
    }
docs: residual primitive weight early in the path)