rewrite main()