changed function structure for main menu.