Finished the union() function