Fixed generator logic, improved Guard