added function

added function sendMessage, removed var addMessage