added a separate function prettyPrintUnion() for handling basic union queries