Could you rewrite it such that it can calculate the distance between any two points?