Fixed numerous codegen bugs. Fuck off by 1 errors.
tidy main up a bit
Merge remote-tracking branch 'origin/buildir'
superficial shit