updated remove_row function, filter_by_distance now uses it