documented _filter_line that does the most complicated part