added filtering for used and unsed