working common_items function