Refactored. There is a little bit of duplication here - parseTables loop needs to know node's table name to enforce the temp restrictions on outer joins. Hopefully, it will go away soon.