compare distance script