add support for generator functions