Refactored ClassGenerator class