Refactored generator to generatorjava