proper state machine for menu and user input