attempt using generator