Tweaked generation code