bellman ford, testcases + some refactorings