Update sendMessage function