Changesfor implementation of generator using templates.