Refactor generator to prototype implementation.