Bugfix in the generator
Doing little refactoring of code management