replace Enum by Gen (almost) everywhere