implenting generator