somewhat simplified state and option references in main()