Added message formation code and sending code