Reworked main menu code.