Added message sending and handling code