(Menu) Split off menu code into functions