point distance working version