Make function ordering more intuitive, etc.

Moved several functions around to provide more intuitive ordering and
made a minor aesthetic adjustment to the code in
"main_menu_select_callback".