work on distance function
finish distance