Modified distance calculator