reworking the build_menu function