Refactor the submenu system