Adding getTotalDistance for calculating the total distance of the set of points
Fix some syntax