added the main menu, control structures, and error detection