added support for sending and receiving messages