modified filter logic