refactor the union method.