[MECHNET] Refactored and slightly changed design of generated code, fixes #54