set up the distance method