massive refactoring of menus and structure to remove duplicate code