Whack at flatten up ^ - really need to fix how unaries and temporary tables are handled