Added support for generators