implemented union and intersection