works on implementing unionBag method