added msg_chan function