updated with filter on distance