refactored to add a shared submenu.