  In Eikonal equations, rarefaction is a common phenomenon known to degrade the
rate of convergence of numerical methods. The `factoring' approach alleviates
this difficulty by deriving a PDE for a new (locally smooth) variable while
capturing the rarefaction-related singularity in a known (non-smooth) `factor'.
Previously this technique was successfully used to address rarefaction fans
arising at point sources. In this paper we show how similar ideas can be used
to factor the 2D rarefactions arising due to nonsmoothness of domain boundaries
or discontinuities in PDE coefficients. Locations and orientations of such
rarefaction fans are not known in advance and we construct a `just-in-time
factoring' method that identifies them dynamically. The resulting algorithm is
a generalization of the Fast Marching Method originally introduced for the
regular (unfactored) Eikonal equations. We show that our approach restores the
first-order convergence and illustrate it using a range of maze navigation
examples with non-permeable and `slowly permeable' obstacles.
