Code for the menu to work correctly.