debugging distance calculations