Shortest Distance formula change