Split the Generator class to Generator and GeneratorUnsafe