Added target distance calculation