Added functionality to send and recieve messages.