modified distance-checker