small refactors to shortest path + bellman Ford