made shortest path calculations more efficient.