Added the ss_distance function