Improve documentation and move the generator definitions farther down.