Modified the filter code