Improvements to the 'Next Hop Determination' code