extract functionality to #prepare_submenu_pages