Add filtering by distance, but it's terribly slow