Made the code generator more OO