No need to have a filter inside each subquery to filter out unwanted schemas - can do that in the main WITH clause
Fix bug: reordering of columns in output file