added filter logic