Refactored generator to use ClassMap