Refactoring the menu gen