WyC: made a copy of the old code generator so that I can resort to using it for now when making released.
WyC: more refactoring of the code generation phase.