diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java
index 63027b0..b972d5a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/PatchSetReviewer.java
@@ -4,6 +4,7 @@
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.chatgpt.client.*;
 import com.googlesource.gerrit.plugins.chatgpt.client.chatgpt.ChatGptClient;
+import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritChange;
 import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritClient;
 import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritClientDetail;
 import com.googlesource.gerrit.plugins.chatgpt.client.model.chatGpt.ChatGptReplyItem;
@@ -30,8 +31,6 @@
     private List<ReviewBatch> reviewBatches;
     private List<GerritComment> commentProperties;
     private HashMap<String, FileDiffProcessed> fileDiffsProcessed;
-    @Setter
-    private boolean isCommentEvent;
 
     @Inject
     PatchSetReviewer(GerritClient gerritClient, ChatGptClient chatGptClient) {
@@ -39,33 +38,33 @@
         this.chatGptClient = chatGptClient;
     }
 
-    public void review(Configuration config, String fullChangeId) throws Exception {
+    public void review(Configuration config, GerritChange change) throws Exception {
         reviewBatches = new ArrayList<>();
-        commentProperties = gerritClient.getCommentProperties(fullChangeId);
-        String patchSet = gerritClient.getPatchSet(fullChangeId, isCommentEvent);
+        commentProperties = gerritClient.getCommentProperties(change);
+        String patchSet = gerritClient.getPatchSet(change);
         if (patchSet.isEmpty()) {
             log.info("No file to review has been found in the PatchSet");
             return;
         }
-        updateDynamicConfiguration(config, fullChangeId);
+        updateDynamicConfiguration(config, change);
 
-        String reviewReply = getReviewReply(config, fullChangeId, patchSet);
+        String reviewReply = getReviewReply(config, change, patchSet);
         log.debug("ChatGPT response: {}", reviewReply);
         ChatGptResponseContent reviewJson = gson.fromJson(reviewReply, ChatGptResponseContent.class);
-        retrieveReviewFromJson(reviewJson, fullChangeId);
+        retrieveReviewFromJson(reviewJson, change);
 
-        gerritClient.setReview(fullChangeId, reviewBatches, reviewJson.getScore());
+        gerritClient.setReview(change, reviewBatches, reviewJson.getScore());
     }
 
-    private void updateDynamicConfiguration(Configuration config, String fullChangeId) {
+    private void updateDynamicConfiguration(Configuration config, GerritChange change) {
         config.configureDynamically(Configuration.KEY_GPT_REQUEST_USER_PROMPT,
-                gerritClient.getUserRequests(fullChangeId));
+                gerritClient.getUserRequests(change));
         config.configureDynamically(Configuration.KEY_COMMENT_PROPERTIES_SIZE, commentProperties.size());
-        if (config.isVotingEnabled() && !isCommentEvent) {
+        if (config.isVotingEnabled() && !change.getIsCommentEvent()) {
             GerritClientDetail gerritClientDetail = new GerritClientDetail(config,
-                    gerritClient.getGptAccountId(fullChangeId));
+                    gerritClient.getGptAccountId(change));
             GerritPatchSetDetail.PermittedVotingRange permittedVotingRange = gerritClientDetail.getPermittedVotingRange(
-                    fullChangeId);
+                    change.getFullChangeId());
             if (permittedVotingRange != null) {
                 if (permittedVotingRange.getMin() > config.getVotingMinScore()) {
                     log.debug("Minimum ChatGPT voting score set to {}", permittedVotingRange.getMin());
@@ -123,11 +122,11 @@
         return gerritCommentRange;
     }
 
-    private void retrieveReviewFromJson(ChatGptResponseContent reviewJson, String fullChangeId) {
-        fileDiffsProcessed = gerritClient.getFileDiffsProcessed(fullChangeId);
+    private void retrieveReviewFromJson(ChatGptResponseContent reviewJson, GerritChange change) {
+        fileDiffsProcessed = gerritClient.getFileDiffsProcessed(change);
         for (ChatGptReplyItem replyItem : reviewJson.getReplies()) {
             ReviewBatch batchMap = new ReviewBatch();
-            if (isCommentEvent && replyItem.getId() != null) {
+            if (change.getIsCommentEvent() && replyItem.getId() != null) {
                 addReviewBatch(replyItem.getId(), replyItem.getReply());
             }
             else {
@@ -145,13 +144,13 @@
         log.debug("fileDiffsProcessed Keys: {}", fileDiffsProcessed.keySet());
     }
 
-    private String getReviewReply(Configuration config, String changeId, String patchSet) throws Exception {
+    private String getReviewReply(Configuration config, GerritChange change, String patchSet) throws Exception {
         List<String> patchLines = Arrays.asList(patchSet.split("\n"));
         if (patchLines.size() > config.getMaxReviewLines()) {
-            log.warn("Patch set too large. Skipping review. changeId: {}", changeId);
+            log.warn("Patch set too large. Skipping review. changeId: {}", change.getFullChangeId());
             return String.format(SPLIT_REVIEW_MSG, config.getMaxReviewLines());
         }
-        return chatGptClient.ask(config, changeId, patchSet, isCommentEvent);
+        return chatGptClient.ask(config, change, patchSet);
     }
 }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptClient.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptClient.java
index e8b942f..34673aa 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptClient.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptClient.java
@@ -6,6 +6,7 @@
 import com.google.inject.Singleton;
 import com.googlesource.gerrit.plugins.chatgpt.client.HttpClientWithRetry;
 import com.googlesource.gerrit.plugins.chatgpt.client.UriResourceLocator;
+import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritChange;
 import com.googlesource.gerrit.plugins.chatgpt.client.model.chatGpt.*;
 import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
 import lombok.Getter;
@@ -56,11 +57,11 @@
         throw new RuntimeException("Failed to receive valid ChatGPT response");
     }
 
-    public String ask(Configuration config, String changeId, String patchSet, boolean isCommentEvent) throws Exception {
-        this.isCommentEvent = isCommentEvent;
-        chatGptTools = new ChatGptTools(isCommentEvent);
+    public String ask(Configuration config, GerritChange change, String patchSet) throws Exception {
+        isCommentEvent = change.getIsCommentEvent();
+        chatGptTools = new ChatGptTools(config, isCommentEvent);
 
-        return this.ask(config, changeId, patchSet);
+        return this.ask(config, change.getFullChangeId(), patchSet);
     }
 
     private String extractContent(Configuration config, String body) throws Exception {
@@ -123,7 +124,7 @@
                 .build();
 
         List<ChatGptRequest.Message> messages = List.of(systemMessage, userMessage);
-        ChatGptRequest tools = chatGptTools.retrieveTools(config);
+        ChatGptRequest tools = chatGptTools.retrieveTools();
         ChatGptRequest chatGptRequest = ChatGptRequest.builder()
                 .model(config.getGptModel())
                 .messages(messages)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptTools.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptTools.java
index 395b2d7..50147b3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptTools.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/chatgpt/ChatGptTools.java
@@ -11,13 +11,15 @@
 class ChatGptTools {
 
     private final Gson gson = new Gson();
+    private final Configuration config;
     private final boolean isCommentEvent;
 
-    public ChatGptTools(boolean isCommentEvent) {
+    public ChatGptTools(Configuration config, Boolean isCommentEvent) {
+        this.config = config;
         this.isCommentEvent = isCommentEvent;
     }
 
-    public ChatGptRequest retrieveTools(Configuration config) {
+    public ChatGptRequest retrieveTools() {
         ChatGptRequest tools;
         try (InputStreamReader reader = FileUtils.getInputStreamReader("Config/tools.json")) {
             tools = gson.fromJson(reader, ChatGptRequest.class);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritChange.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritChange.java
new file mode 100644
index 0000000..d7d0d5a
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritChange.java
@@ -0,0 +1,69 @@
+package com.googlesource.gerrit.plugins.chatgpt.client.gerrit;
+
+import com.google.gerrit.entities.BranchNameKey;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.server.data.PatchSetAttribute;
+import com.google.gerrit.server.events.Event;
+import com.google.gerrit.server.events.PatchSetEvent;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.Optional;
+
+@Slf4j
+@Getter
+public class GerritChange {
+    private Event event;
+    private String eventType;
+    private long eventTimeStamp;
+    private PatchSetEvent patchSetEvent;
+    private Project.NameKey projectNameKey;
+    private BranchNameKey branchNameKey;
+    private Change.Key changeKey;
+    private String fullChangeId;
+    @Setter
+    private Boolean isCommentEvent;
+
+    public GerritChange(Project.NameKey projectNameKey, BranchNameKey branchNameKey, Change.Key changeKey) {
+        this.projectNameKey = projectNameKey;
+        this.branchNameKey = branchNameKey;
+        this.changeKey = changeKey;
+        buildFullChangeId();
+    }
+
+    public GerritChange(Event event) {
+        this(
+                ((PatchSetEvent) event).getProjectNameKey(),
+                ((PatchSetEvent) event).getBranchNameKey(),
+                ((PatchSetEvent) event).getChangeKey()
+        );
+        this.event = event;
+        eventType = event.getType();
+        eventTimeStamp = event.eventCreatedOn;
+        patchSetEvent = (PatchSetEvent) event;
+    }
+
+    // Incomplete initialization used by CodeReviewPluginIT
+    public GerritChange(String fullChangeId) {
+        this.fullChangeId = fullChangeId;
+    }
+
+    public Optional<PatchSetAttribute> getPatchSetAttribute() {
+        try {
+            return Optional.ofNullable(patchSetEvent.patchSet.get());
+        }
+        catch (NullPointerException e) {
+            return Optional.empty();
+        }
+    }
+
+    private void buildFullChangeId() {
+        fullChangeId = String.join("~", URLEncoder.encode(projectNameKey.get(), StandardCharsets.UTF_8),
+                branchNameKey.shortName(), changeKey.get());
+    }
+
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClient.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClient.java
index b908eb3..b11edd9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClient.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClient.java
@@ -1,6 +1,5 @@
 package com.googlesource.gerrit.plugins.chatgpt.client.gerrit;
 
-import com.google.gerrit.server.events.Event;
 import com.google.inject.Singleton;
 import com.googlesource.gerrit.plugins.chatgpt.client.FileDiffProcessed;
 import com.googlesource.gerrit.plugins.chatgpt.client.model.gerrit.GerritComment;
@@ -19,26 +18,26 @@
     private static GerritClientFacade gerritClientFacade;
 
     public void initialize(Configuration config) {
-        initialize(config, DEFAULT_CHANGE_ID);
+        initialize(config, new GerritChange(DEFAULT_CHANGE_ID));
     }
 
-    public void initialize(Configuration config, String fullChangeId) {
-        log.debug("Initializing client instances for change: {}", fullChangeId);
+    public void initialize(Configuration config, GerritChange change) {
+        log.debug("Initializing client instances for change: {}", change.getFullChangeId());
         config.resetDynamicConfiguration();
-        gerritClientFacade = SingletonManager.getInstance(GerritClientFacade.class, fullChangeId, config);
+        gerritClientFacade = SingletonManager.getInstance(GerritClientFacade.class, change.getFullChangeId(), config);
     }
 
     public String getPatchSet(String fullChangeId) throws Exception {
-        return getPatchSet(fullChangeId, false);
+        return getPatchSet(new GerritChange(fullChangeId));
     }
 
-    public String getPatchSet(String fullChangeId, boolean isCommentEvent) throws Exception {
-        updateGerritClientFacade(fullChangeId);
-        return gerritClientFacade.getPatchSet(fullChangeId, isCommentEvent);
+    public String getPatchSet(GerritChange change) throws Exception {
+        updateGerritClientFacade(change);
+        return gerritClientFacade.getPatchSet(change);
     }
 
-    public boolean getForcedReview(String fullChangeId) {
-        updateGerritClientFacade(fullChangeId);
+    public boolean getForcedReview(GerritChange change) {
+        updateGerritClientFacade(change);
         return gerritClientFacade.getForcedReview();
     }
 
@@ -50,47 +49,47 @@
         return gerritClientFacade.isDisabledTopic(topic);
     }
 
-    public HashMap<String, FileDiffProcessed> getFileDiffsProcessed(String fullChangeId) {
-        updateGerritClientFacade(fullChangeId);
+    public HashMap<String, FileDiffProcessed> getFileDiffsProcessed(GerritChange change) {
+        updateGerritClientFacade(change);
         return gerritClientFacade.getFileDiffsProcessed();
     }
 
-    public Integer getGptAccountId(String fullChangeId) {
-        updateGerritClientFacade(fullChangeId);
+    public Integer getGptAccountId(GerritChange change) {
+        updateGerritClientFacade(change);
         return gerritClientFacade.getGptAccountId();
     }
 
-    public List<GerritComment> getCommentProperties(String fullChangeId) {
-        updateGerritClientFacade(fullChangeId);
+    public List<GerritComment> getCommentProperties(GerritChange change) {
+        updateGerritClientFacade(change);
         return gerritClientFacade.getCommentProperties();
     }
 
-    public void setReview(String fullChangeId, List<ReviewBatch> reviewBatches, Integer reviewScore) throws Exception {
-        updateGerritClientFacade(fullChangeId);
-        gerritClientFacade.setReview(fullChangeId, reviewBatches, reviewScore);
-    }
-
     public void setReview(String fullChangeId, List<ReviewBatch> reviewBatches) throws Exception {
-        setReview(fullChangeId, reviewBatches, null);
+        setReview(new GerritChange(fullChangeId), reviewBatches, null);
     }
 
-    public boolean retrieveLastComments(String fullChangeId, Event event) {
-        updateGerritClientFacade(fullChangeId);
-        return gerritClientFacade.retrieveLastComments(fullChangeId, event);
+    public void setReview(GerritChange change, List<ReviewBatch> reviewBatches, Integer reviewScore) throws Exception {
+        updateGerritClientFacade(change);
+        gerritClientFacade.setReview(change.getFullChangeId(), reviewBatches, reviewScore);
     }
 
-    public String getUserRequests(String fullChangeId) {
-        updateGerritClientFacade(fullChangeId);
+    public boolean retrieveLastComments(GerritChange change) {
+        updateGerritClientFacade(change);
+        return gerritClientFacade.retrieveLastComments(change);
+    }
+
+    public String getUserRequests(GerritChange change) {
+        updateGerritClientFacade(change);
         return gerritClientFacade.getUserRequests();
     }
 
-    public void destroy(String fullChangeId) {
-        log.debug("Destroying GerritClientFacade instance for change: {}", fullChangeId);
-        SingletonManager.removeInstance(GerritClientFacade.class, fullChangeId);
+    public void destroy(GerritChange change) {
+        log.debug("Destroying GerritClientFacade instance for change: {}", change.getFullChangeId());
+        SingletonManager.removeInstance(GerritClientFacade.class, change.getFullChangeId());
     }
 
-    private void updateGerritClientFacade(String fullChangeId) {
-        gerritClientFacade = SingletonManager.getInstance(GerritClientFacade.class, fullChangeId);
+    private void updateGerritClientFacade(GerritChange change) {
+        gerritClientFacade = SingletonManager.getInstance(GerritClientFacade.class, change.getFullChangeId());
     }
 
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientComments.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientComments.java
index 2adadbe..98f6327 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientComments.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientComments.java
@@ -1,7 +1,6 @@
 package com.googlesource.gerrit.plugins.chatgpt.client.gerrit;
 
 import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.Event;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.googlesource.gerrit.plugins.chatgpt.client.FileDiffProcessed;
@@ -33,7 +32,6 @@
     @Getter
     private final Integer gptAccountId;
     private final HashMap<String, GerritComment> commentMap;
-    private long commentsStartTimestamp;
     private String authorUsername;
     @Getter
     private List<GerritComment> commentProperties;
@@ -48,12 +46,11 @@
                 "Error retrieving ChatGPT account ID in Gerrit"));
     }
 
-    public boolean retrieveLastComments(Event event, String fullChangeId) {
-        commentsStartTimestamp = event.eventCreatedOn;
+    public boolean retrieveLastComments(GerritChange change) {
         forcedReview = false;
-        CommentAddedEvent commentAddedEvent = (CommentAddedEvent) event;
+        CommentAddedEvent commentAddedEvent = (CommentAddedEvent) change.getEvent();
         authorUsername = commentAddedEvent.author.get().username;
-        log.debug("Found comments by '{}' on {}", authorUsername, commentsStartTimestamp);
+        log.debug("Found comments by '{}' on {}", authorUsername, change.getEventTimeStamp());
         if (authorUsername.equals(config.getGerritUserName())) {
             log.debug("These are the Bot's own comments, do not process them.");
             return false;
@@ -62,7 +59,7 @@
             log.info("Review of comments from user '{}' is disabled.", authorUsername);
             return false;
         }
-        addAllComments(fullChangeId);
+        addAllComments(change);
 
         return !commentProperties.isEmpty();
     }
@@ -77,9 +74,9 @@
         return requestItems.isEmpty() ? "" : gson.toJson(requestItems);
     }
 
-    private List<GerritComment> getLastComments(String fullChangeId) throws Exception {
+    private List<GerritComment> getLastComments(GerritChange change) throws Exception {
         URI uri = URI.create(config.getGerritAuthBaseUrl()
-                + UriResourceLocator.gerritGetAllPatchSetCommentsUri(fullChangeId));
+                + UriResourceLocator.gerritGetAllPatchSetCommentsUri(change.getFullChangeId()));
         String responseBody = forwardGetRequest(uri);
         Type mapEntryType = new TypeToken<Map<String, List<GerritComment>>>(){}.getType();
         Map<String, List<GerritComment>> lastCommentMap = gson.fromJson(responseBody, mapEntryType);
@@ -100,7 +97,7 @@
                 log.debug("Change Message Id: {} - Author: {}", latestChangeMessageId, commentAuthorUsername);
                 long updatedTimeStamp = getTimeStamp(commentObject.getUpdated());
                 if (commentAuthorUsername.equals(authorUsername) &&
-                        updatedTimeStamp >= commentsStartTimestamp - MAX_SECS_GAP_BETWEEN_EVENT_AND_COMMENT) {
+                        updatedTimeStamp >= change.getEventTimeStamp() - MAX_SECS_GAP_BETWEEN_EVENT_AND_COMMENT) {
                     log.debug("Found comment with updatedTimeStamp : {}", updatedTimeStamp);
                     latestChangeMessageId = changeMessageId;
                 }
@@ -136,9 +133,9 @@
         return reviewCommandMatcher.find();
     }
 
-    private void addAllComments(String fullChangeId) {
+    private void addAllComments(GerritChange change) {
         try {
-            List<GerritComment> latestComments = getLastComments(fullChangeId);
+            List<GerritComment> latestComments = getLastComments(change);
             if (latestComments == null) {
                 return;
             }
@@ -155,7 +152,7 @@
                 }
             }
         } catch (Exception e) {
-            log.error("Error while retrieving comments for change: {}", fullChangeId, e);
+            log.error("Error while retrieving comments for change: {}", change.getFullChangeId(), e);
         }
     }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientFacade.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientFacade.java
index f1c866e..e9d4733 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientFacade.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientFacade.java
@@ -1,6 +1,5 @@
 package com.googlesource.gerrit.plugins.chatgpt.client.gerrit;
 
-import com.google.gerrit.server.events.Event;
 import com.googlesource.gerrit.plugins.chatgpt.client.FileDiffProcessed;
 import com.googlesource.gerrit.plugins.chatgpt.client.model.ReviewBatch;
 import com.googlesource.gerrit.plugins.chatgpt.client.model.gerrit.GerritComment;
@@ -23,8 +22,8 @@
         gerritClientReview = new GerritClientReview(config);
     }
 
-    public String getPatchSet(String fullChangeId, boolean isCommentEvent) throws Exception {
-        return gerritClientPatchSet.getPatchSet(fullChangeId, isCommentEvent);
+    public String getPatchSet(GerritChange change) throws Exception {
+        return gerritClientPatchSet.getPatchSet(change);
     }
 
     public boolean getForcedReview() {
@@ -55,8 +54,8 @@
         gerritClientReview.setReview(fullChangeId, reviewBatches, reviewScore);
     }
 
-    public boolean retrieveLastComments(String fullChangeId, Event event) {
-        return gerritClientComments.retrieveLastComments(event, fullChangeId);
+    public boolean retrieveLastComments(GerritChange change) {
+        return gerritClientComments.retrieveLastComments(change);
     }
 
     public String getUserRequests() {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientPatchSet.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientPatchSet.java
index c81e616..fa160a8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientPatchSet.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/gerrit/GerritClientPatchSet.java
@@ -27,14 +27,14 @@
         diffs = new ArrayList<>();
     }
 
-    public String getPatchSet(String fullChangeId, boolean isCommentEvent) throws Exception {
-        int revisionBase = isCommentEvent ? 0 : retrieveRevisionBase(fullChangeId);
+    public String getPatchSet(GerritChange change) throws Exception {
+        int revisionBase = change.getIsCommentEvent() ? 0 : retrieveRevisionBase(change.getFullChangeId());
         log.debug("Revision base: {}", revisionBase);
 
-        List<String> files = getAffectedFiles(fullChangeId, revisionBase);
+        List<String> files = getAffectedFiles(change.getFullChangeId(), revisionBase);
         log.debug("Patch files: {}", files);
 
-        String fileDiffsJson = getFileDiffsJson(fullChangeId, files, revisionBase);
+        String fileDiffsJson = getFileDiffsJson(change.getFullChangeId(), files, revisionBase);
         log.debug("File diffs: {}", fileDiffsJson);
 
         return fileDiffsJson;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/listener/EventListenerHandler.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/listener/EventListenerHandler.java
index 2887d38..836d9fc 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/listener/EventListenerHandler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/listener/EventListenerHandler.java
@@ -2,23 +2,18 @@
 
 import com.google.common.base.Splitter;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.google.gerrit.entities.BranchNameKey;
-import com.google.gerrit.entities.Change;
-import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.client.ChangeKind;
 import com.google.gerrit.server.data.ChangeAttribute;
 import com.google.gerrit.server.data.PatchSetAttribute;
 import com.google.gerrit.server.events.Event;
-import com.google.gerrit.server.events.PatchSetEvent;
 import com.google.inject.Inject;
 import com.googlesource.gerrit.plugins.chatgpt.PatchSetReviewer;
+import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritChange;
 import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritClient;
 import com.googlesource.gerrit.plugins.chatgpt.config.Configuration;
 import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -54,39 +49,29 @@
         addShutdownHoot();
     }
 
-    public static String buildFullChangeId(Project.NameKey projectName, BranchNameKey branchName, Change.Key changeKey) {
-        return String.join("~", URLEncoder.encode(projectName.get(), StandardCharsets.UTF_8),
-                branchName.shortName(), changeKey.get());
-    }
-
     public void handleEvent(Configuration config, Event event) {
         this.config = config;
-        PatchSetEvent patchSetEvent = (PatchSetEvent) event;
-        Project.NameKey projectNameKey = patchSetEvent.getProjectNameKey();
-        BranchNameKey branchNameKey = patchSetEvent.getBranchNameKey();
-        Change.Key changeKey = patchSetEvent.getChangeKey();
-        String fullChangeId = buildFullChangeId(projectNameKey, branchNameKey, changeKey);
+        GerritChange change = new GerritChange(event);
+        gerritClient.initialize(config, change);
 
-        gerritClient.initialize(config, fullChangeId);
-
-        if (!preprocessEvent(event, fullChangeId, projectNameKey)) {
-            gerritClient.destroy(fullChangeId);
+        if (!preprocessEvent(change)) {
+            gerritClient.destroy(change);
             return;
         }
 
         // Execute the potentially time-consuming operation asynchronously
         latestFuture = CompletableFuture.runAsync(() -> {
             try {
-                log.info("Processing change: {}", fullChangeId);
-                reviewer.review(config, fullChangeId);
-                log.info("Finished processing change: {}", fullChangeId);
+                log.info("Processing change: {}", change.getFullChangeId());
+                reviewer.review(config, change);
+                log.info("Finished processing change: {}", change.getFullChangeId());
             } catch (Exception e) {
-                log.error("Error while processing change: {}", fullChangeId, e);
+                log.error("Error while processing change: {}", change.getFullChangeId(), e);
                 if (e instanceof InterruptedException) {
                     Thread.currentThread().interrupt();
                 }
             } finally {
-                gerritClient.destroy(fullChangeId);
+                gerritClient.destroy(change);
             }
         }, executorService);
     }
@@ -105,18 +90,9 @@
         }));
     }
 
-    private Optional<PatchSetAttribute> getPatchSetAttribute(PatchSetEvent patchSetEvent) {
+    private Optional<String> getTopic(GerritChange change) {
         try {
-            return Optional.ofNullable(patchSetEvent.patchSet.get());
-        }
-        catch (NullPointerException e) {
-            return Optional.empty();
-        }
-    }
-
-    private Optional<String> getTopic(PatchSetEvent patchSetEvent) {
-        try {
-            ChangeAttribute changeAttribute = patchSetEvent.change.get();
+            ChangeAttribute changeAttribute = change.getPatchSetEvent().change.get();
             return Optional.ofNullable(changeAttribute.topic);
         }
         catch (NullPointerException e) {
@@ -124,17 +100,17 @@
         }
     }
 
-    private boolean isReviewEnabled(PatchSetEvent patchSetEvent, Project.NameKey projectNameKey) {
+    private boolean isReviewEnabled(GerritChange change) {
         List<String> enabledProjects = Splitter.on(",").omitEmptyStrings()
                 .splitToList(config.getEnabledProjects());
         if (!config.isGlobalEnable() &&
-                !enabledProjects.contains(projectNameKey.get()) &&
+                !enabledProjects.contains(change.getProjectNameKey().get()) &&
                 !config.isProjectEnable()) {
-            log.debug("The project {} is not enabled for review", projectNameKey);
+            log.debug("The project {} is not enabled for review", change.getProjectNameKey());
             return false;
         }
 
-        String topic = getTopic(patchSetEvent).orElse("");
+        String topic = getTopic(change).orElse("");
         log.debug("PatchSet Topic retrieved: '{}'", topic);
         if (gerritClient.isDisabledTopic(topic)) {
             log.info("Disabled review for PatchSets with Topic '{}'", topic);
@@ -144,12 +120,12 @@
         return true;
     }
 
-    private boolean isPatchSetReviewEnabled(PatchSetEvent patchSetEvent) {
+    private boolean isPatchSetReviewEnabled(GerritChange change) {
         if (!config.getGptReviewPatchSet()) {
             log.debug("Disabled review function for created or updated PatchSets.");
             return false;
         }
-        Optional<PatchSetAttribute> patchSetAttributeOptional = getPatchSetAttribute(patchSetEvent);
+        Optional<PatchSetAttribute> patchSetAttributeOptional = change.getPatchSetAttribute();
         if (patchSetAttributeOptional.isEmpty()) {
             log.info("PatchSetAttribute event properties not retrieved");
             return false;
@@ -168,21 +144,20 @@
         return true;
     }
 
-    private boolean preprocessEvent(Event event, String fullChangeId, Project.NameKey projectNameKey) {
-        String eventType = Optional.ofNullable(event.getType()).orElse("");
+    private boolean preprocessEvent(GerritChange change) {
+        String eventType = Optional.ofNullable(change.getEventType()).orElse("");
         log.info("Event type {}", eventType);
         if (!EVENT_COMMENT_MAP.containsKey(eventType) ) {
             return false;
         }
-        PatchSetEvent patchSetEvent = (PatchSetEvent) event;
 
-        if (!isReviewEnabled(patchSetEvent, projectNameKey)) {
+        if (!isReviewEnabled(change)) {
             return false;
         }
         boolean isCommentEvent = EVENT_COMMENT_MAP.get(eventType);
         if (isCommentEvent) {
-            if (!gerritClient.retrieveLastComments(fullChangeId, event)) {
-                if (gerritClient.getForcedReview(fullChangeId)) {
+            if (!gerritClient.retrieveLastComments(change)) {
+                if (gerritClient.getForcedReview(change)) {
                     isCommentEvent = false;
                 }
                 else {
@@ -192,13 +167,13 @@
             }
         }
         else {
-            if (!isPatchSetReviewEnabled(patchSetEvent)) {
+            if (!isPatchSetReviewEnabled(change)) {
                 log.debug("Patch Set review disabled");
                 return false;
             }
         }
         log.debug("Flag `isCommentEvent` set to {}", isCommentEvent);
-        reviewer.setCommentEvent(isCommentEvent);
+        change.setIsCommentEvent(isCommentEvent);
 
         return true;
     }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/chatgpt/ChatGptReviewTest.java b/src/test/java/com/googlesource/gerrit/plugins/chatgpt/ChatGptReviewTest.java
index 0f40ec4..bb939a9 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/chatgpt/ChatGptReviewTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/chatgpt/ChatGptReviewTest.java
@@ -17,6 +17,7 @@
 import com.google.gson.JsonArray;
 import com.google.gson.Gson;
 import com.google.gson.JsonObject;
+import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritChange;
 import com.googlesource.gerrit.plugins.chatgpt.client.gerrit.GerritClient;
 import com.googlesource.gerrit.plugins.chatgpt.client.chatgpt.ChatGptClient;
 import com.googlesource.gerrit.plugins.chatgpt.client.UriResourceLocator;
@@ -48,7 +49,6 @@
 
 import static com.google.gerrit.extensions.client.ChangeKind.REWORK;
 import static com.googlesource.gerrit.plugins.chatgpt.client.UriResourceLocator.*;
-import static com.googlesource.gerrit.plugins.chatgpt.listener.EventListenerHandler.buildFullChangeId;
 import static java.net.HttpURLConnection.HTTP_OK;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -103,6 +103,10 @@
         initComparisonContent();
     }
 
+    private String getFullChangeId() {
+        return new GerritChange(PROJECT_NAME, BRANCH_NAME, CHANGE_ID).getFullChangeId();
+    }
+
     private void initConfig() {
         globalConfig = mock(PluginConfig.class);
         Answer<Object> returnDefaultArgument = invocation -> {
@@ -137,7 +141,7 @@
 
     private void setupMockRequests() {
         Configuration config = new Configuration(globalConfig, projectConfig);
-        String fullChangeId = buildFullChangeId(PROJECT_NAME, BRANCH_NAME, CHANGE_ID);
+        String fullChangeId = getFullChangeId();
 
         // Mock the behavior of the gerritAccountIdUri request
         WireMock.stubFor(WireMock.get(gerritAccountIdUri(GERRIT_GPT_USERNAME))
@@ -278,7 +282,7 @@
         future.get();
 
         RequestPatternBuilder requestPatternBuilder = WireMock.postRequestedFor(
-                WireMock.urlEqualTo(gerritSetReviewUri(buildFullChangeId(PROJECT_NAME, BRANCH_NAME, CHANGE_ID))));
+                WireMock.urlEqualTo(gerritSetReviewUri(getFullChangeId())));
         List<LoggedRequest> loggedRequests = WireMock.findAll(requestPatternBuilder);
         Assert.assertEquals(1, loggedRequests.size());
         JsonObject gptRequestBody = gson.fromJson(chatGptClient.getRequestBody(), JsonObject.class);
@@ -325,7 +329,7 @@
         future.get();
 
         RequestPatternBuilder requestPatternBuilder = WireMock.postRequestedFor(
-                WireMock.urlEqualTo(gerritSetReviewUri(buildFullChangeId(PROJECT_NAME, BRANCH_NAME, CHANGE_ID))));
+                WireMock.urlEqualTo(gerritSetReviewUri(getFullChangeId())));
         List<LoggedRequest> loggedRequests = WireMock.findAll(requestPatternBuilder);
         Assert.assertEquals(1, loggedRequests.size());
         JsonObject gptRequestBody = gson.fromJson(chatGptClient.getRequestBody(), JsonObject.class);
@@ -402,7 +406,7 @@
                 config.getCommentRequestUserPrompt()
         ));
         RequestPatternBuilder requestPatternBuilder = WireMock.postRequestedFor(
-                WireMock.urlEqualTo(gerritSetReviewUri(buildFullChangeId(PROJECT_NAME, BRANCH_NAME, CHANGE_ID))));
+                WireMock.urlEqualTo(gerritSetReviewUri(getFullChangeId())));
         List<LoggedRequest> loggedRequests = WireMock.findAll(requestPatternBuilder);
         Assert.assertEquals(1, loggedRequests.size());
         JsonObject gptRequestBody = gson.fromJson(chatGptClient.getRequestBody(), JsonObject.class);
