generator made more generic