speed improvement to path calcuations.