Now calculating distances in 3-space