better naming and comment in shortestPath