changed naive to be generator function