Added functionality for sendMessage