added distance functions to use numpy arrays.