added a check to make sure only one distance is returned per query for cases where two equally nearest distances in opposite direction were returned.