Added UNION clauses to queries to pickup inverse relationships