Various minor improvements to shortest path