reorganize filter (504-530) for efficiency