added filtering logic, need to test