diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index ee55132..89cddcf 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -321,9 +321,9 @@
   result.setName(request.getName());
   result.setFreshnessPeriod(DEFAULT_DATA_FRESHNESS_PERIOD);
   result.setContent(requesttlv::encodeDataContent(myEcdhPubKeyBase64,
-                                                             salt,
-                                                             requestState.m_requestId, requestState.m_status,
-                                                             m_config.m_caProfile.m_supportedChallenges));
+                                                  salt,
+                                                  requestState.requestId, requestState.status,
+                                                  m_config.m_caProfile.m_supportedChallenges));
   m_keyChain.sign(result, signingByIdentity( m_config.m_caProfile.m_caPrefix));
   m_face.put(result);
   if (m_statusUpdateCallback) {
@@ -343,7 +343,7 @@
     return;
   }
   // verify signature
-  if (!security::verifySignature(request, requestState->m_cert)) {
+  if (!security::verifySignature(request, requestState->cert)) {
     NDN_LOG_ERROR("Invalid Signature in the Interest packet.");
     m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::BAD_SIGNATURE,
                                        "Invalid Signature in the Interest packet."));
@@ -353,20 +353,20 @@
   Buffer paramTLVPayload;
   try {
     paramTLVPayload = decodeBlockWithAesGcm128(request.getApplicationParameters(),
-                                               requestState->m_encryptionKey.data(),
-                                               requestState->m_requestId.data(),
-                                               requestState->m_requestId.size());
+                                               requestState->encryptionKey.data(),
+                                               requestState->requestId.data(),
+                                               requestState->requestId.size());
   }
   catch (const std::exception& e) {
     NDN_LOG_ERROR("Interest paramaters decryption failed: " << e.what());
-    m_storage->deleteRequest(requestState->m_requestId);
+    m_storage->deleteRequest(requestState->requestId);
     m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER,
                                        "Interest paramaters decryption failed."));
     return;
   }
   if (paramTLVPayload.size() == 0) {
     NDN_LOG_ERROR("No parameters are found after decryption.");
-    m_storage->deleteRequest(requestState->m_requestId);
+    m_storage->deleteRequest(requestState->requestId);
     m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER,
                                        "No parameters are found after decryption."));
     return;
@@ -379,7 +379,7 @@
   auto challenge = ChallengeModule::createChallengeModule(challengeType);
   if (challenge == nullptr) {
     NDN_LOG_TRACE("Unrecognized challenge type: " << challengeType);
-    m_storage->deleteRequest(requestState->m_requestId);
+    m_storage->deleteRequest(requestState->requestId);
     m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER, "Unrecognized challenge type."));
     return;
   }
@@ -387,26 +387,26 @@
   NDN_LOG_TRACE("CHALLENGE module to be load: " << challengeType);
   auto errorInfo = challenge->handleChallengeRequest(paramTLV, *requestState);
   if (std::get<0>(errorInfo) != ErrorCode::NO_ERROR) {
-    m_storage->deleteRequest(requestState->m_requestId);
+    m_storage->deleteRequest(requestState->requestId);
     m_face.put(generateErrorDataPacket(request.getName(), std::get<0>(errorInfo), std::get<1>(errorInfo)));
     return;
   }
 
   Block payload;
-  if (requestState->m_status == Status::PENDING) {
+  if (requestState->status == Status::PENDING) {
     // if challenge succeeded
-    if (requestState->m_requestType == RequestType::NEW) {
+    if (requestState->requestType == RequestType::NEW) {
       auto issuedCert = issueCertificate(*requestState);
-      requestState->m_cert = issuedCert;
-      requestState->m_status = Status::SUCCESS;
-      m_storage->deleteRequest(requestState->m_requestId);
+      requestState->cert = issuedCert;
+      requestState->status = Status::SUCCESS;
+      m_storage->deleteRequest(requestState->requestId);
 
       payload = challengetlv::encodeDataContent(*requestState, issuedCert.getName());
       NDN_LOG_TRACE("Challenge succeeded. Certificate has been issued: " << issuedCert.getName());
     }
-    else if (requestState->m_requestType == RequestType::REVOKE) {
-      requestState->m_status = Status::SUCCESS;
-      m_storage->deleteRequest(requestState->m_requestId);
+    else if (requestState->requestType == RequestType::REVOKE) {
+      requestState->status = Status::SUCCESS;
+      m_storage->deleteRequest(requestState->requestId);
 
       payload = challengetlv::encodeDataContent(*requestState);
       NDN_LOG_TRACE("Challenge succeeded. Certificate has been revoked");
@@ -432,15 +432,15 @@
 security::Certificate
 CaModule::issueCertificate(const RequestState& requestState)
 {
-  auto expectedPeriod = requestState.m_cert.getValidityPeriod().getPeriod();
+  auto expectedPeriod = requestState.cert.getValidityPeriod().getPeriod();
   security::ValidityPeriod period(expectedPeriod.first, expectedPeriod.second);
   security::Certificate newCert;
 
-  Name certName = requestState.m_cert.getKeyName();
+  Name certName = requestState.cert.getKeyName();
   certName.append("NDNCERT").append(std::to_string(random::generateSecureWord64()));
   newCert.setName(certName);
-  newCert.setContent(requestState.m_cert.getContent());
-  NDN_LOG_TRACE("cert request content " << requestState.m_cert);
+  newCert.setContent(requestState.cert.getContent());
+  NDN_LOG_TRACE("cert request content " << requestState.cert);
   SignatureInfo signatureInfo;
   signatureInfo.setValidityPeriod(period);
   security::SigningInfo signingInfo(security::SigningInfo::SIGNER_TYPE_ID,
diff --git a/src/challenge/challenge-credential.cpp b/src/challenge/challenge-credential.cpp
index a9ebe1c..cac5aa0 100644
--- a/src/challenge/challenge-credential.cpp
+++ b/src/challenge/challenge-credential.cpp
@@ -111,7 +111,7 @@
   for (auto anchor : m_trustAnchors) {
     if (anchor.getKeyName() == signingKeyName) {
       if (security::verifySignature(credential, anchor) &&
-          security::verifySignature(request.m_requestId.data(), request.m_requestId.size(), signature, signatureLen, key)) {
+          security::verifySignature(request.requestId.data(), request.requestId.size(), signature, signatureLen, key)) {
         return returnWithSuccess(request);
       }
     }
diff --git a/src/challenge/challenge-email.cpp b/src/challenge/challenge-email.cpp
index 8b08d82..ba0a0e8 100644
--- a/src/challenge/challenge-email.cpp
+++ b/src/challenge/challenge-email.cpp
@@ -48,13 +48,13 @@
 {
   params.parse();
   auto currentTime = time::system_clock::now();
-  if (request.m_status == Status::BEFORE_CHALLENGE) {
+  if (request.status == Status::BEFORE_CHALLENGE) {
     // for the first time, init the challenge
     std::string emailAddress = readString(params.get(tlv::ParameterValue));
     if (!isValidEmailAddress(emailAddress)) {
       return returnWithNewChallengeStatus(request, INVALID_EMAIL, JsonSection(), m_maxAttemptTimes - 1, m_secretLifetime);
     }
-    auto lastComponentRequested = readString(request.m_cert.getIdentity().get(-1));
+    auto lastComponentRequested = readString(request.cert.getIdentity().get(-1));
     if (lastComponentRequested != emailAddress) {
       NDN_LOG_TRACE("Email and requested name do not match. Email " << emailAddress << "requested last component "
                     << lastComponentRequested);
@@ -64,18 +64,18 @@
     secretJson.add(PARAMETER_KEY_CODE, emailCode);
     // send out the email
     sendEmail(emailAddress, emailCode, request);
-    NDN_LOG_TRACE("Secret for request " << toHex(request.m_requestId.data(), request.m_requestId.size())  << " : " << emailCode);
+    NDN_LOG_TRACE("Secret for request " << toHex(request.requestId.data(), request.requestId.size()) << " : " << emailCode);
     return returnWithNewChallengeStatus(request, NEED_CODE, std::move(secretJson), m_maxAttemptTimes, m_secretLifetime);
   }
-  if (request.m_challengeState) {
-    if (request.m_challengeState->m_challengeStatus == NEED_CODE ||
-        request.m_challengeState->m_challengeStatus == WRONG_CODE) {
-      NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.m_challengeState->m_challengeStatus);
+  if (request.challengeState) {
+    if (request.challengeState->challengeStatus == NEED_CODE ||
+        request.challengeState->challengeStatus == WRONG_CODE) {
+      NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.challengeState->challengeStatus);
       // the incoming interest should bring the pin code
       std::string givenCode = readString(params.get(tlv::ParameterValue));
-      auto secret = request.m_challengeState->m_secrets;
+      auto secret = request.challengeState->secrets;
       // check if run out of time
-      if (currentTime - request.m_challengeState->m_timestamp >= m_secretLifetime) {
+      if (currentTime - request.challengeState->timestamp >= m_secretLifetime) {
         return returnWithError(request, ErrorCode::OUT_OF_TIME, "Secret expired.");
       }
       // check if provided secret is correct
@@ -85,11 +85,11 @@
         return returnWithSuccess(request);
       }
       // otherwise, check remaining attempt times
-      if (request.m_challengeState->m_remainingTries > 1) {
-        auto remainTime = m_secretLifetime - (currentTime - request.m_challengeState->m_timestamp);
+      if (request.challengeState->remainingTries > 1) {
+        auto remainTime = m_secretLifetime - (currentTime - request.challengeState->timestamp);
         NDN_LOG_TRACE("Wrong secret code provided. Remaining Tries - 1.");
         return returnWithNewChallengeStatus(request, WRONG_CODE, std::move(secret),
-                                            request.m_challengeState->m_remainingTries - 1,
+                                            request.challengeState->remainingTries - 1,
                                             time::duration_cast<time::seconds>(remainTime));
       }
       else {
@@ -164,8 +164,8 @@
 {
   std::string command = m_sendEmailScript;
   command += " \"" + emailAddress + "\" \"" + secret + "\" \"" +
-             request.m_caPrefix.toUri() + "\" \"" +
-             request.m_cert.getName().toUri() + "\"";
+             request.caPrefix.toUri() + "\" \"" +
+             request.cert.getName().toUri() + "\"";
   boost::process::child child(command);
   child.wait();
   if (child.exit_code() != 0) {
diff --git a/src/challenge/challenge-module.cpp b/src/challenge/challenge-module.cpp
index 8de88b6..708cbb6 100644
--- a/src/challenge/challenge-module.cpp
+++ b/src/challenge/challenge-module.cpp
@@ -75,9 +75,9 @@
 std::tuple<ErrorCode, std::string>
 ChallengeModule::returnWithError(ca::RequestState& request, ErrorCode errorCode, std::string&& errorInfo)
 {
-  request.m_status = Status::FAILURE;
-  request.m_challengeType = "";
-  request.m_challengeState = nullopt;
+  request.status = Status::FAILURE;
+  request.challengeType = "";
+  request.challengeState = nullopt;
   return std::make_tuple(errorCode, std::move(errorInfo));
 }
 
@@ -85,19 +85,19 @@
 ChallengeModule::returnWithNewChallengeStatus(ca::RequestState& request, const std::string& challengeStatus,
                                               JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime)
 {
-  request.m_status = Status::CHALLENGE;
-  request.m_challengeType = CHALLENGE_TYPE;
-  request.m_challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime,
-                                                std::move(challengeSecret));
+  request.status = Status::CHALLENGE;
+  request.challengeType = CHALLENGE_TYPE;
+  request.challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime,
+                                              std::move(challengeSecret));
   return std::make_tuple(ErrorCode::NO_ERROR, "");
 }
 
 std::tuple<ErrorCode, std::string>
 ChallengeModule::returnWithSuccess(ca::RequestState& request)
 {
-  request.m_status = Status::PENDING;
-  request.m_challengeType = CHALLENGE_TYPE;
-  request.m_challengeState = nullopt;
+  request.status = Status::PENDING;
+  request.challengeType = CHALLENGE_TYPE;
+  request.challengeState = nullopt;
   return std::make_tuple(ErrorCode::NO_ERROR, "");
 }
 
diff --git a/src/challenge/challenge-pin.cpp b/src/challenge/challenge-pin.cpp
index 1ae6753..26e5317 100644
--- a/src/challenge/challenge-pin.cpp
+++ b/src/challenge/challenge-pin.cpp
@@ -42,23 +42,23 @@
 {
   params.parse();
   auto currentTime = time::system_clock::now();
-  if (request.m_status == Status::BEFORE_CHALLENGE) {
+  if (request.status == Status::BEFORE_CHALLENGE) {
     NDN_LOG_TRACE("Challenge Interest arrives. Init the challenge");
     // for the first time, init the challenge
     std::string secretCode = generateSecretCode();
     JsonSection secretJson;
     secretJson.add(PARAMETER_KEY_CODE, secretCode);
-    NDN_LOG_TRACE("Secret for request " << toHex(request.m_requestId.data(), request.m_requestId.size()) << " : " << secretCode);
+    NDN_LOG_TRACE("Secret for request " << toHex(request.requestId.data(), request.requestId.size()) << " : " << secretCode);
     return returnWithNewChallengeStatus(request, NEED_CODE, std::move(secretJson), m_maxAttemptTimes, m_secretLifetime);
   }
-  if (request.m_challengeState) {
-    if (request.m_challengeState->m_challengeStatus == NEED_CODE ||
-        request.m_challengeState->m_challengeStatus == WRONG_CODE) {
-      NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.m_challengeState->m_challengeStatus);
+  if (request.challengeState) {
+    if (request.challengeState->challengeStatus == NEED_CODE ||
+        request.challengeState->challengeStatus == WRONG_CODE) {
+      NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.challengeState->challengeStatus);
       // the incoming interest should bring the pin code
       std::string givenCode = readString(params.get(tlv::ParameterValue));
-      auto secret = request.m_challengeState->m_secrets;
-      if (currentTime - request.m_challengeState->m_timestamp >= m_secretLifetime) {
+      auto secret = request.challengeState->secrets;
+      if (currentTime - request.challengeState->timestamp >= m_secretLifetime) {
         return returnWithError(request, ErrorCode::OUT_OF_TIME, "Secret expired.");
       }
       if (givenCode == secret.get<std::string>(PARAMETER_KEY_CODE)) {
@@ -66,11 +66,11 @@
         return returnWithSuccess(request);
       }
       // check rest attempt times
-      if (request.m_challengeState->m_remainingTries > 1) {
-        auto remainTime = m_secretLifetime - (currentTime - request.m_challengeState->m_timestamp);
+      if (request.challengeState->remainingTries > 1) {
+        auto remainTime = m_secretLifetime - (currentTime - request.challengeState->timestamp);
         NDN_LOG_TRACE("Wrong PIN code provided. Remaining Tries - 1.");
         return returnWithNewChallengeStatus(request, WRONG_CODE, std::move(secret),
-                                            request.m_challengeState->m_remainingTries - 1,
+                                            request.challengeState->remainingTries - 1,
                                             time::duration_cast<time::seconds>(remainTime));
       }
       else {
diff --git a/src/detail/ca-memory.cpp b/src/detail/ca-memory.cpp
index f2a3b12..48a0903 100644
--- a/src/detail/ca-memory.cpp
+++ b/src/detail/ca-memory.cpp
@@ -48,21 +48,21 @@
 void
 CaMemory::addRequest(const RequestState& request)
 {
-  auto search = m_requests.find(request.m_requestId);
+  auto search = m_requests.find(request.requestId);
   if (search == m_requests.end()) {
-    m_requests.insert(std::make_pair(request.m_requestId, request));
+    m_requests.insert(std::make_pair(request.requestId, request));
   }
   else {
-    NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " already exists"));
+    NDN_THROW(std::runtime_error("Request " + toHex(request.requestId.data(), request.requestId.size()) + " already exists"));
   }
 }
 
 void
 CaMemory::updateRequest(const RequestState& request)
 {
-  auto search = m_requests.find(request.m_requestId);
+  auto search = m_requests.find(request.requestId);
   if (search == m_requests.end()) {
-    m_requests.insert(std::make_pair(request.m_requestId, request));
+    m_requests.insert(std::make_pair(request.requestId, request));
   }
   else {
     search->second = request;
@@ -73,7 +73,7 @@
 CaMemory::deleteRequest(const RequestId& requestId)
 {
   auto search = m_requests.find(requestId);
-  auto keyName = search->second.m_cert.getKeyName();
+  auto keyName = search->second.cert.getKeyName();
   if (search != m_requests.end()) {
     m_requests.erase(search);
   }
@@ -94,7 +94,7 @@
 {
   std::list<RequestState> result;
   for (const auto& entry : m_requests) {
-    if (entry.second.m_caPrefix == caName) {
+    if (entry.second.caPrefix == caName) {
       result.push_back(entry.second);
     }
   }
diff --git a/src/detail/ca-request-state.cpp b/src/detail/ca-request-state.cpp
index adb453f..55b5cf9 100644
--- a/src/detail/ca-request-state.cpp
+++ b/src/detail/ca-request-state.cpp
@@ -58,23 +58,23 @@
                                const time::system_clock::TimePoint& challengeTp,
                                size_t remainingTries, time::seconds remainingTime,
                                JsonSection&& challengeSecrets)
-    : m_challengeStatus(challengeStatus)
-    , m_timestamp(challengeTp)
-    , m_remainingTries(remainingTries)
-    , m_remainingTime(remainingTime)
-    , m_secrets(std::move(challengeSecrets))
+    : challengeStatus(challengeStatus)
+    , timestamp(challengeTp)
+    , remainingTries(remainingTries)
+    , remainingTime(remainingTime)
+    , secrets(std::move(challengeSecrets))
 {
 }
 
 RequestState::RequestState(const Name& caName, const RequestId& requestId, RequestType requestType, Status status,
                            const security::Certificate& cert, std::array<uint8_t, 16>&& encryptionKey, uint32_t aesBlockCounter)
-    : m_caPrefix(caName)
-    , m_requestId(requestId)
-    , m_requestType(requestType)
-    , m_status(status)
-    , m_cert(cert)
-    , m_encryptionKey(std::move(encryptionKey))
-    , m_aesBlockCounter(aesBlockCounter)
+    : caPrefix(caName)
+    , requestId(requestId)
+    , requestType(requestType)
+    , status(status)
+    , cert(cert)
+    , encryptionKey(std::move(encryptionKey))
+    , aesBlockCounter(aesBlockCounter)
 {
 }
 
@@ -83,34 +83,34 @@
                            const std::string& challengeStatus, const time::system_clock::TimePoint& challengeTp,
                            size_t remainingTries, time::seconds remainingTime, JsonSection&& challengeSecrets,
                            std::array<uint8_t, 16>&& encryptionKey, uint32_t aesBlockCounter)
-    : m_caPrefix(caName)
-    , m_requestId(requestId)
-    , m_requestType(requestType)
-    , m_status(status)
-    , m_cert(cert)
-    , m_encryptionKey(std::move(encryptionKey))
-    , m_aesBlockCounter(aesBlockCounter)
-    , m_challengeType(challengeType)
-    , m_challengeState(ChallengeState(challengeStatus, challengeTp, remainingTries, remainingTime, std::move(challengeSecrets)))
+    : caPrefix(caName)
+    , requestId(requestId)
+    , requestType(requestType)
+    , status(status)
+    , cert(cert)
+    , encryptionKey(std::move(encryptionKey))
+    , aesBlockCounter(aesBlockCounter)
+    , challengeType(challengeType)
+    , challengeState(ChallengeState(challengeStatus, challengeTp, remainingTries, remainingTime, std::move(challengeSecrets)))
 {
 }
 
 std::ostream&
 operator<<(std::ostream& os, const RequestState& request)
 {
-  os << "Request's CA name: " << request.m_caPrefix << "\n";
-  os << "Request's request ID: " << toHex(request.m_requestId.data(), request.m_requestId.size()) << "\n";
-  os << "Request's status: " << statusToString(request.m_status) << "\n";
-  os << "Request's challenge type: " << request.m_challengeType << "\n";
-  if (request.m_challengeState) {
-    os << "Challenge Status: " << request.m_challengeState->m_challengeStatus << "\n";
-    os << "Challenge remaining tries:" << request.m_challengeState->m_remainingTries << " times\n";
-    os << "Challenge remaining time: " << request.m_challengeState->m_remainingTime.count() << " seconds\n";
-    os << "Challenge last update: " << time::toIsoString(request.m_challengeState->m_timestamp) << "\n";
+  os << "Request's CA name: " << request.caPrefix << "\n";
+  os << "Request's request ID: " << toHex(request.requestId.data(), request.requestId.size()) << "\n";
+  os << "Request's status: " << statusToString(request.status) << "\n";
+  os << "Request's challenge type: " << request.challengeType << "\n";
+  if (request.challengeState) {
+    os << "Challenge Status: " << request.challengeState->challengeStatus << "\n";
+    os << "Challenge remaining tries:" << request.challengeState->remainingTries << " times\n";
+    os << "Challenge remaining time: " << request.challengeState->remainingTime.count() << " seconds\n";
+    os << "Challenge last update: " << time::toIsoString(request.challengeState->timestamp) << "\n";
   }
   os << "Certificate:\n";
   util::IndentedStream os2(os, "  ");
-  os2 << request.m_cert;
+  os2 << request.cert;
   return os;
 }
 
diff --git a/src/detail/ca-request-state.hpp b/src/detail/ca-request-state.hpp
index 160760e..1857509 100644
--- a/src/detail/ca-request-state.hpp
+++ b/src/detail/ca-request-state.hpp
@@ -62,23 +62,23 @@
   /**
    * @brief The status of the challenge.
    */
-  std::string m_challengeStatus;
+  std::string challengeStatus;
   /**
    * @brief The timestamp of the last update of the challenge state.
    */
-  time::system_clock::TimePoint m_timestamp;
+  time::system_clock::TimePoint timestamp;
   /**
    * @brief Remaining tries of the challenge.
    */
-  size_t m_remainingTries;
+  size_t remainingTries;
   /**
    * @brief Remaining time of the challenge.
    */
-  time::seconds m_remainingTime;
+  time::seconds remainingTime;
   /**
    * @brief The secret for the challenge.
    */
-  JsonSection m_secrets;
+  JsonSection secrets;
 };
 
 /**
@@ -107,40 +107,40 @@
   /**
    * @brief The CA that the request is under.
    */
-  Name m_caPrefix;
+  Name caPrefix;
   /**
    * @brief The ID of the request.
    */
-  RequestId m_requestId;
+  RequestId requestId;
   /**
    * @brief The type of the request.
    */
-  RequestType m_requestType = RequestType::NOTINITIALIZED;
+  RequestType requestType = RequestType::NOTINITIALIZED;
   /**
    * @brief The status of the request.
    */
-  Status m_status;
+  Status status;
   /**
    * @brief The self-signed certificate in the request.
    */
-  security::Certificate m_cert;
+  security::Certificate cert;
   /**
    * @brief The encryption key for the requester.
    */
-  std::array<uint8_t, 16> m_encryptionKey;
+  std::array<uint8_t, 16> encryptionKey;
   /**
    * @brief The AES block counter for the requester.
    */
-  uint32_t m_aesBlockCounter = 0;
+  uint32_t aesBlockCounter = 0;
 
   /**
    * @brief The challenge type.
    */
-  std::string m_challengeType;
+  std::string challengeType;
   /**
    * @brief The challenge state.
    */
-  optional<ChallengeState> m_challengeState;
+  optional<ChallengeState> challengeState;
 };
 
 std::ostream&
diff --git a/src/detail/ca-sqlite.cpp b/src/detail/ca-sqlite.cpp
index 6ef80bc..db37397 100644
--- a/src/detail/ca-sqlite.cpp
+++ b/src/detail/ca-sqlite.cpp
@@ -172,24 +172,24 @@
                   cert_request, challenge_type, challenge_status, challenge_secrets,
                   challenge_tp, remaining_tries, remaining_time, encryption_key, aes_block_counter)
                   values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?))_SQLTEXT_");
-  statement.bind(1, request.m_requestId.data(), request.m_requestId.size(), SQLITE_TRANSIENT);
-  statement.bind(2, request.m_caPrefix.wireEncode(), SQLITE_TRANSIENT);
-  statement.bind(3, static_cast<int>(request.m_status));
-  statement.bind(4, static_cast<int>(request.m_requestType));
-  statement.bind(5, request.m_cert.wireEncode(), SQLITE_TRANSIENT);
-  statement.bind(12, request.m_encryptionKey.data(), request.m_encryptionKey.size(), SQLITE_TRANSIENT);
-  statement.bind(13, request.m_aesBlockCounter);
-  if (request.m_challengeState) {
-    statement.bind(6, request.m_challengeType, SQLITE_TRANSIENT);
-    statement.bind(7, request.m_challengeState->m_challengeStatus, SQLITE_TRANSIENT);
-    statement.bind(8, convertJson2String(request.m_challengeState->m_secrets),
+  statement.bind(1, request.requestId.data(), request.requestId.size(), SQLITE_TRANSIENT);
+  statement.bind(2, request.caPrefix.wireEncode(), SQLITE_TRANSIENT);
+  statement.bind(3, static_cast<int>(request.status));
+  statement.bind(4, static_cast<int>(request.requestType));
+  statement.bind(5, request.cert.wireEncode(), SQLITE_TRANSIENT);
+  statement.bind(12, request.encryptionKey.data(), request.encryptionKey.size(), SQLITE_TRANSIENT);
+  statement.bind(13, request.aesBlockCounter);
+  if (request.challengeState) {
+    statement.bind(6, request.challengeType, SQLITE_TRANSIENT);
+    statement.bind(7, request.challengeState->challengeStatus, SQLITE_TRANSIENT);
+    statement.bind(8, convertJson2String(request.challengeState->secrets),
                    SQLITE_TRANSIENT);
-    statement.bind(9, time::toIsoString(request.m_challengeState->m_timestamp), SQLITE_TRANSIENT);
-    statement.bind(10, request.m_challengeState->m_remainingTries);
-    statement.bind(11, request.m_challengeState->m_remainingTime.count());
+    statement.bind(9, time::toIsoString(request.challengeState->timestamp), SQLITE_TRANSIENT);
+    statement.bind(10, request.challengeState->remainingTries);
+    statement.bind(11, request.challengeState->remainingTime.count());
   }
   if (statement.step() != SQLITE_DONE) {
-    NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " cannot be added to database"));
+    NDN_THROW(std::runtime_error("Request " + toHex(request.requestId.data(), request.requestId.size()) + " cannot be added to database"));
   }
 }
 
@@ -201,14 +201,14 @@
                              SET status = ?, challenge_type = ?, challenge_status = ?, challenge_secrets = ?,
                              challenge_tp = ?, remaining_tries = ?, remaining_time = ?, aes_block_counter = ?
                              WHERE request_id = ?)_SQLTEXT_");
-  statement.bind(1, static_cast<int>(request.m_status));
-  statement.bind(2, request.m_challengeType, SQLITE_TRANSIENT);
-  if (request.m_challengeState) {
-    statement.bind(3, request.m_challengeState->m_challengeStatus, SQLITE_TRANSIENT);
-    statement.bind(4, convertJson2String(request.m_challengeState->m_secrets), SQLITE_TRANSIENT);
-    statement.bind(5, time::toIsoString(request.m_challengeState->m_timestamp), SQLITE_TRANSIENT);
-    statement.bind(6, request.m_challengeState->m_remainingTries);
-    statement.bind(7, request.m_challengeState->m_remainingTime.count());
+  statement.bind(1, static_cast<int>(request.status));
+  statement.bind(2, request.challengeType, SQLITE_TRANSIENT);
+  if (request.challengeState) {
+    statement.bind(3, request.challengeState->challengeStatus, SQLITE_TRANSIENT);
+    statement.bind(4, convertJson2String(request.challengeState->secrets), SQLITE_TRANSIENT);
+    statement.bind(5, time::toIsoString(request.challengeState->timestamp), SQLITE_TRANSIENT);
+    statement.bind(6, request.challengeState->remainingTries);
+    statement.bind(7, request.challengeState->remainingTime.count());
   }
   else {
     statement.bind(3, "", SQLITE_TRANSIENT);
@@ -217,8 +217,8 @@
     statement.bind(6, 0);
     statement.bind(7, 0);
   }
-  statement.bind(8, request.m_aesBlockCounter);
-  statement.bind(9, request.m_requestId.data(), request.m_requestId.size(), SQLITE_TRANSIENT);
+  statement.bind(8, request.aesBlockCounter);
+  statement.bind(9, request.requestId.data(), request.requestId.size(), SQLITE_TRANSIENT);
 
   if (statement.step() != SQLITE_DONE) {
     addRequest(request);
diff --git a/src/detail/challenge-encoder.cpp b/src/detail/challenge-encoder.cpp
index 41a0f8f..12eb7cf 100644
--- a/src/detail/challenge-encoder.cpp
+++ b/src/detail/challenge-encoder.cpp
@@ -27,21 +27,21 @@
 challengetlv::encodeDataContent(ca::RequestState& request, const Name& issuedCertName)
 {
   Block response(tlv::EncryptedPayload);
-  response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<uint64_t>(request.m_status)));
-  if (request.m_challengeState) {
-    response.push_back(makeStringBlock(tlv::ChallengeStatus, request.m_challengeState->m_challengeStatus));
+  response.push_back(makeNonNegativeIntegerBlock(tlv::Status, static_cast<uint64_t>(request.status)));
+  if (request.challengeState) {
+    response.push_back(makeStringBlock(tlv::ChallengeStatus, request.challengeState->challengeStatus));
     response.push_back(
-        makeNonNegativeIntegerBlock(tlv::RemainingTries, request.m_challengeState->m_remainingTries));
+        makeNonNegativeIntegerBlock(tlv::RemainingTries, request.challengeState->remainingTries));
     response.push_back(
-        makeNonNegativeIntegerBlock(tlv::RemainingTime, request.m_challengeState->m_remainingTime.count()));
+        makeNonNegativeIntegerBlock(tlv::RemainingTime, request.challengeState->remainingTime.count()));
   }
   if (!issuedCertName.empty()) {
     response.push_back(makeNestedBlock(tlv::IssuedCertName, issuedCertName));
   }
   response.encode();
-  return encodeBlockWithAesGcm128(ndn::tlv::Content, request.m_encryptionKey.data(),
+  return encodeBlockWithAesGcm128(ndn::tlv::Content, request.encryptionKey.data(),
                                   response.value(), response.value_size(),
-                                  request.m_requestId.data(), request.m_requestId.size(), request.m_aesBlockCounter);
+                                  request.requestId.data(), request.requestId.size(), request.aesBlockCounter);
 }
 
 void
diff --git a/src/detail/probe-encoder.cpp b/src/detail/probe-encoder.cpp
index e8f5218..d671aef 100644
--- a/src/detail/probe-encoder.cpp
+++ b/src/detail/probe-encoder.cpp
@@ -24,7 +24,7 @@
 namespace ndncert {
 
 Block
-probetlv::encodeApplicationParameters(std::multimap<std::string, std::string>&& parameters)
+probetlv::encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters)
 {
   Block content(ndn::tlv::ApplicationParameters);
   for (const auto& items : parameters) {
diff --git a/src/detail/probe-encoder.hpp b/src/detail/probe-encoder.hpp
index 2b63cc1..bde8a87 100644
--- a/src/detail/probe-encoder.hpp
+++ b/src/detail/probe-encoder.hpp
@@ -29,7 +29,7 @@
 
 // For Client use
 Block
-encodeApplicationParameters(std::multimap<std::string, std::string>&& parameters);
+encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters);
 
 void
 decodeDataContent(const Block& block, std::vector<std::pair<Name, int>>& availableNames,
