[WIP] Codegen errors

- [x] Remove duplication of interfaces
- [x] Fix fatal errors
Should this go to a different utility class instead?