Made some changes to the menu function