factor path code a bit.