Improving checks in filter