Fixed bug in advanced() editing.

Bogus menus were being generated.

Also refactored menu_generate() to be similar to
pretty_print_helper(), and joined them together.
This makes for a consistent interface across the menus now (i think).