added copyright and comments to gen.pl