add logic for filter