More clean up of MetaGenerator and added main() to make it stand-alone.