Move all of the code to menu_common.c to avoid code duplication
across frontends