step 2 almost working... sorting the rows with distance in them returns improperly sorted table