Simplified calculateDistance