added avg command
utility for computing average distance