implemented yield, next and generators patterns