[WIP] Codegen errors

- [x] Remove duplication of interfaces
- [x] Fix fatal errors
Isn't this conditional redundant with itself?