Some minor refinements to main()