Added distances array to the start of the script