Fixed generate script comments
Corrected distance calculation to remove angular distortion