added logic to interact with the menu