Compiler now includes joins, but is quite messy.