changed distance calculation to be one way