Removed repeat code from sendMessage.