Rewrite of CFG generation, adds options and fixes issue #459.
Removed obsolete file generate2.py
Merge pull request #460 from heatherleaf/master

Bugfix and rewrite of CFG generation