changed to include distance test