Make the class generator more robust. A lot of work for no visible changes, wohooo! :P