Cleaning the distance table part of script.