Added filter logic