wrote write_message() and main()