Refactored out a lot of extraneous functions into one single generate_menu function