Complete initial implementation of generator. Next up: adding tests.