diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java
index ba84031..3bbbac0 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTree.java
@@ -93,8 +93,8 @@
     private void diskOrderScan(ITreeIndexCursor icursor, BTreeOpContext ctx) throws HyracksDataException {
         TreeIndexDiskOrderScanCursor cursor = (TreeIndexDiskOrderScanCursor) icursor;
         ctx.reset();
-        RangePredicate diskOrderScanPred = new RangePredicate(null, null, true, true, ctx.cmp, ctx.cmp);
-        int maxPageId = freePageManager.getMaxPageId(ctx.metaFrame);
+        RangePredicate diskOrderScanPred = new RangePredicate(null, null, true, true, ctx.getCmp(), ctx.getCmp());
+        int maxPageId = freePageManager.getMaxPageId(ctx.getMetaFrame());
         int currentPageId = bulkloadLeafStart;
         ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, currentPageId), false);
         page.acquireReadLatch();
@@ -103,10 +103,10 @@
             cursor.setFileId(fileId);
             cursor.setCurrentPageId(currentPageId);
             cursor.setMaxPageId(maxPageId);
-            ctx.cursorInitialState.setPage(page);
-            ctx.cursorInitialState.setSearchOperationCallback(ctx.searchCallback);
-            ctx.cursorInitialState.setOriginialKeyComparator(ctx.cmp);
-            cursor.open(ctx.cursorInitialState, diskOrderScanPred);
+            ctx.getCursorInitialState().setPage(page);
+            ctx.getCursorInitialState().setSearchOperationCallback(ctx.getSearchCallback());
+            ctx.getCursorInitialState().setOriginialKeyComparator(ctx.getCmp());
+            cursor.open(ctx.getCursorInitialState(), diskOrderScanPred);
         } catch (Exception e) {
             page.releaseReadLatch();
             bufferCache.unpin(page);
@@ -122,7 +122,7 @@
         BTreeAccessor accessor =
                 (BTreeAccessor) createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
         PageValidationInfo pvi = accessor.ctx.createPageValidationInfo(null);
-        accessor.ctx.validationInfos.addFirst(pvi);
+        accessor.ctx.getValidationInfos().addFirst(pvi);
         if (isActive) {
             validate(accessor.ctx, rootPage);
         }
@@ -130,19 +130,19 @@
 
     private void validate(BTreeOpContext ctx, int pageId) throws HyracksDataException {
         ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-        ctx.interiorFrame.setPage(page);
-        PageValidationInfo currentPvi = ctx.validationInfos.peekFirst();
+        ctx.getInteriorFrame().setPage(page);
+        PageValidationInfo currentPvi = ctx.getValidationInfos().peekFirst();
 
-        boolean isLeaf = ctx.interiorFrame.isLeaf();
+        boolean isLeaf = ctx.getInteriorFrame().isLeaf();
         if (isLeaf) {
-            ctx.leafFrame.setPage(page);
-            ctx.leafFrame.validate(currentPvi);
+            ctx.getLeafFrame().setPage(page);
+            ctx.getLeafFrame().validate(currentPvi);
         } else {
             PageValidationInfo nextPvi = ctx.createPageValidationInfo(currentPvi);
-            List<Integer> children = ((BTreeNSMInteriorFrame) ctx.interiorFrame).getChildren(ctx.cmp);
-            ctx.interiorFrame.validate(currentPvi);
+            List<Integer> children = ((BTreeNSMInteriorFrame) ctx.getInteriorFrame()).getChildren(ctx.getCmp());
+            ctx.getInteriorFrame().validate(currentPvi);
             for (int i = 0; i < children.size(); i++) {
-                ctx.interiorFrame.setPage(page);
+                ctx.getInteriorFrame().setPage(page);
 
                 if (children.size() == 1) {
                     // There is a single child pointer with no keys, so propagate both low and high ranges
@@ -153,54 +153,54 @@
                     //      1) propagate the low range key from the parent
                     //      2) adjust the high range key
                     nextPvi.propagateLowRangeKey(currentPvi);
-                    ctx.interiorFrameTuple.resetByTupleIndex(ctx.interiorFrame, i);
-                    nextPvi.adjustHighRangeKey(ctx.interiorFrameTuple);
+                    ctx.getInteriorFrameTuple().resetByTupleIndex(ctx.getInteriorFrame(), i);
+                    nextPvi.adjustHighRangeKey(ctx.getInteriorFrameTuple());
                 } else if (i == children.size() - 1) {
                     // There is more than one child pointer and this is the right-most child pointer, so:
                     //      1) propagate the high range key from the parent
                     //      2) adjust the low range key
                     nextPvi.propagateHighRangeKey(currentPvi);
-                    ctx.interiorFrameTuple.resetByTupleIndex(ctx.interiorFrame, i - 1);
-                    nextPvi.adjustLowRangeKey(ctx.interiorFrameTuple);
+                    ctx.getInteriorFrameTuple().resetByTupleIndex(ctx.getInteriorFrame(), i - 1);
+                    nextPvi.adjustLowRangeKey(ctx.getInteriorFrameTuple());
                 } else {
                     // There is more than one child pointer and this pointer is not the left/right-most pointer, so:
                     //      1) adjust the low range key
                     //      2) adjust the high range key
-                    ctx.interiorFrameTuple.resetByTupleIndex(ctx.interiorFrame, i - 1);
-                    nextPvi.adjustLowRangeKey(ctx.interiorFrameTuple);
-                    ctx.interiorFrameTuple.resetByTupleIndex(ctx.interiorFrame, i);
-                    nextPvi.adjustHighRangeKey(ctx.interiorFrameTuple);
+                    ctx.getInteriorFrameTuple().resetByTupleIndex(ctx.getInteriorFrame(), i - 1);
+                    nextPvi.adjustLowRangeKey(ctx.getInteriorFrameTuple());
+                    ctx.getInteriorFrameTuple().resetByTupleIndex(ctx.getInteriorFrame(), i);
+                    nextPvi.adjustHighRangeKey(ctx.getInteriorFrameTuple());
                 }
 
-                ctx.validationInfos.addFirst(nextPvi);
+                ctx.getValidationInfos().addFirst(nextPvi);
                 validate(ctx, children.get(i));
             }
         }
         bufferCache.unpin(page);
-        ctx.validationInfos.removeFirst();
+        ctx.getValidationInfos().removeFirst();
     }
 
     private void search(ITreeIndexCursor cursor, ISearchPredicate searchPred, BTreeOpContext ctx)
             throws HyracksDataException {
         ctx.reset();
-        ctx.pred = (RangePredicate) searchPred;
-        ctx.cursor = cursor;
+        ctx.setPred((RangePredicate) searchPred);
+        ctx.setCursor(cursor);
         // simple index scan
-        if (ctx.pred.getLowKeyComparator() == null) {
-            ctx.pred.setLowKeyComparator(ctx.cmp);
+        if (ctx.getPred().getLowKeyComparator() == null) {
+            ctx.getPred().setLowKeyComparator(ctx.getCmp());
         }
-        if (ctx.pred.getHighKeyComparator() == null) {
-            ctx.pred.setHighKeyComparator(ctx.cmp);
+        if (ctx.getPred().getHighKeyComparator() == null) {
+            ctx.getPred().setHighKeyComparator(ctx.getCmp());
         }
         // we use this loop to deal with possibly multiple operation restarts
         // due to ongoing structure modifications during the descent
         boolean repeatOp = true;
-        while (repeatOp && ctx.opRestarts < MAX_RESTARTS) {
+        while (repeatOp && ctx.getOpRestarts() < MAX_RESTARTS) {
             performOp(rootPage, null, true, ctx);
             // if we reach this stage then we need to restart from the (possibly
             // new) root
-            if (!ctx.pageLsns.isEmpty() && ctx.pageLsns.getLast() == RESTART_OP) {
-                ctx.pageLsns.removeLast(); // pop the restart op indicator
+            if (!ctx.getPageLsns().isEmpty() && ctx.getPageLsns().getLast() == RESTART_OP) {
+                ctx.getPageLsns().removeLast(); // pop the restart op indicator
                 continue;
             }
             repeatOp = false;
@@ -210,38 +210,38 @@
     }
 
     private void unsetSmPages(BTreeOpContext ctx) throws HyracksDataException {
-        ICachedPage originalPage = ctx.interiorFrame.getPage();
-        for (int i = 0; i < ctx.smPages.size(); i++) {
-            int pageId = ctx.smPages.get(i);
+        ICachedPage originalPage = ctx.getInteriorFrame().getPage();
+        for (int i = 0; i < ctx.getSmPages().size(); i++) {
+            int pageId = ctx.getSmPages().get(i);
             ICachedPage smPage = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
             smPage.acquireWriteLatch();
             try {
-                ctx.interiorFrame.setPage(smPage);
-                ctx.interiorFrame.setSmFlag(false);
+                ctx.getInteriorFrame().setPage(smPage);
+                ctx.getInteriorFrame().setSmFlag(false);
             } finally {
                 smPage.releaseWriteLatch(true);
                 bufferCache.unpin(smPage);
             }
         }
-        if (ctx.smPages.size() > 0) {
-            if (ctx.smoCount == Integer.MAX_VALUE) {
+        if (ctx.getSmPages().size() > 0) {
+            if (ctx.getSmoCount() == Integer.MAX_VALUE) {
                 smoCounter.set(0);
             } else {
                 smoCounter.incrementAndGet();
             }
             treeLatch.writeLock().unlock();
-            ctx.smPages.clear();
+            ctx.getSmPages().clear();
         }
-        ctx.interiorFrame.setPage(originalPage);
+        ctx.getInteriorFrame().setPage(originalPage);
     }
 
     private void createNewRoot(BTreeOpContext ctx) throws HyracksDataException {
         // Make sure the root is always in the same page.
         ICachedPage leftNode =
-                bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, ctx.splitKey.getLeftPage()), false);
+                bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, ctx.getSplitKey().getLeftPage()), false);
         leftNode.acquireWriteLatch();
         try {
-            int newLeftId = freePageManager.takePage(ctx.metaFrame);
+            int newLeftId = freePageManager.takePage(ctx.getMetaFrame());
             ICachedPage newLeftNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, newLeftId), true);
             newLeftNode.acquireWriteLatch();
             try {
@@ -254,31 +254,31 @@
                 // Copy left child to new left child.
                 System.arraycopy(leftNode.getBuffer().array(), 0, newLeftNode.getBuffer().array(), 0,
                         newLeftNode.getBuffer().capacity());
-                ctx.interiorFrame.setPage(newLeftNode);
-                ctx.interiorFrame.setSmFlag(false);
+                ctx.getInteriorFrame().setPage(newLeftNode);
+                ctx.getInteriorFrame().setSmFlag(false);
                 // Remember LSN to set it in the root.
-                long leftNodeLSN = ctx.interiorFrame.getPageLsn();
+                long leftNodeLSN = ctx.getInteriorFrame().getPageLsn();
                 // Initialize new root (leftNode becomes new root).
                 if (largePage) {
                     bufferCache.resizePage(leftNode, 1, ctx);
-                    ctx.interiorFrame.setPage(leftNode);
-                    ctx.interiorFrame.setLargeFlag(false);
+                    ctx.getInteriorFrame().setPage(leftNode);
+                    ctx.getInteriorFrame().setLargeFlag(false);
                 } else {
-                    ctx.interiorFrame.setPage(leftNode);
-                    ctx.interiorFrame.setLargeFlag(false);
+                    ctx.getInteriorFrame().setPage(leftNode);
+                    ctx.getInteriorFrame().setLargeFlag(false);
                 }
-                ctx.interiorFrame.initBuffer((byte) (ctx.interiorFrame.getLevel() + 1));
+                ctx.getInteriorFrame().initBuffer((byte) (ctx.getInteriorFrame().getLevel() + 1));
                 // Copy over LSN.
-                ctx.interiorFrame.setPageLsn(leftNodeLSN);
+                ctx.getInteriorFrame().setPageLsn(leftNodeLSN);
                 // Will be cleared later in unsetSmPages.
-                ctx.interiorFrame.setSmFlag(true);
-                ctx.splitKey.setLeftPage(newLeftId);
-                int targetTupleIndex = ctx.interiorFrame.findInsertTupleIndex(ctx.splitKey.getTuple());
-                int tupleSize = ctx.interiorFrame.getBytesRequiredToWriteTuple(ctx.splitKey.getTuple());
+                ctx.getInteriorFrame().setSmFlag(true);
+                ctx.getSplitKey().setLeftPage(newLeftId);
+                int targetTupleIndex = ctx.getInteriorFrame().findInsertTupleIndex(ctx.getSplitKey().getTuple());
+                int tupleSize = ctx.getInteriorFrame().getBytesRequiredToWriteTuple(ctx.getSplitKey().getTuple());
                 if (tupleSize > maxTupleSize) {
                     throw HyracksDataException.create(ErrorCode.RECORD_IS_TOO_LARGE, tupleSize, maxTupleSize);
                 }
-                ctx.interiorFrame.insert(ctx.splitKey.getTuple(), targetTupleIndex);
+                ctx.getInteriorFrame().insert(ctx.getSplitKey().getTuple(), targetTupleIndex);
             } finally {
                 newLeftNode.releaseWriteLatch(true);
                 bufferCache.unpin(newLeftNode);
@@ -292,42 +292,35 @@
     private boolean insertLeaf(ITupleReference tuple, int targetTupleIndex, int pageId, BTreeOpContext ctx)
             throws Exception {
         boolean restartOp = false;
-        FrameOpSpaceStatus spaceStatus = ctx.leafFrame.hasSpaceInsert(tuple);
+        FrameOpSpaceStatus spaceStatus = ctx.getLeafFrame().hasSpaceInsert(tuple);
 
         switch (spaceStatus) {
             case EXPAND: {
                 // TODO: avoid repeated calculation of tuple size
-                ctx.leafFrame.ensureCapacity(bufferCache, tuple, ctx);
+                ctx.getLeafFrame().ensureCapacity(bufferCache, tuple, ctx);
             }
             // fall-through
             case SUFFICIENT_CONTIGUOUS_SPACE: {
-                ctx.modificationCallback.found(null, tuple);
-                ctx.leafFrame.insert(tuple, targetTupleIndex);
-                ctx.splitKey.reset();
+                ctx.getModificationCallback().found(null, tuple);
+                ctx.getLeafFrame().insert(tuple, targetTupleIndex);
+                ctx.getSplitKey().reset();
                 break;
             }
             case SUFFICIENT_SPACE: {
-                boolean slotsChanged = ctx.leafFrame.compact();
-                if (slotsChanged) {
-                    targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(tuple);
-                }
-                ctx.modificationCallback.found(null, tuple);
-                ctx.leafFrame.insert(tuple, targetTupleIndex);
-                ctx.splitKey.reset();
+                int finalIndex = ctx.getLeafFrame().compact() ? ctx.getLeafFrame().findInsertTupleIndex(tuple)
+                        : targetTupleIndex;
+                ctx.getModificationCallback().found(null, tuple);
+                ctx.getLeafFrame().insert(tuple, finalIndex);
+                ctx.getSplitKey().reset();
                 break;
             }
             case INSUFFICIENT_SPACE: {
                 // Try compressing the page first and see if there is space available.
-                boolean reCompressed = ctx.leafFrame.compress();
-                if (reCompressed) {
-                    // Compression could have changed the target tuple index, find it again.
-                    targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(tuple);
-                    spaceStatus = ctx.leafFrame.hasSpaceInsert(tuple);
-                }
-                if (spaceStatus == FrameOpSpaceStatus.SUFFICIENT_CONTIGUOUS_SPACE) {
-                    ctx.modificationCallback.found(null, tuple);
-                    ctx.leafFrame.insert(tuple, targetTupleIndex);
-                    ctx.splitKey.reset();
+                if (ctx.getLeafFrame().compress()
+                        && ctx.getLeafFrame().hasSpaceInsert(tuple) == FrameOpSpaceStatus.SUFFICIENT_CONTIGUOUS_SPACE) {
+                    ctx.getModificationCallback().found(null, tuple);
+                    ctx.getLeafFrame().insert(tuple, ctx.getLeafFrame().findInsertTupleIndex(tuple));
+                    ctx.getSplitKey().reset();
                 } else {
                     restartOp = performLeafSplit(pageId, tuple, ctx, -1);
                 }
@@ -351,42 +344,42 @@
             return true;
         } else {
             int tempSmoCount = smoCounter.get();
-            if (tempSmoCount != ctx.smoCount) {
+            if (tempSmoCount != ctx.getSmoCount()) {
                 treeLatch.writeLock().unlock();
                 return true;
             }
         }
-        int rightPageId = freePageManager.takePage(ctx.metaFrame);
+        int rightPageId = freePageManager.takePage(ctx.getMetaFrame());
         ICachedPage rightNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, rightPageId), true);
         rightNode.acquireWriteLatch();
         try {
             IBTreeLeafFrame rightFrame = ctx.createLeafFrame();
             rightFrame.setPage(rightNode);
             rightFrame.initBuffer((byte) 0);
-            rightFrame.setMultiComparator(ctx.cmp);
+            rightFrame.setMultiComparator(ctx.getCmp());
 
             // Perform an update (delete + insert) if the updateTupleIndex != -1
             if (updateTupleIndex != -1) {
-                ITupleReference beforeTuple = ctx.leafFrame.getMatchingKeyTuple(tuple, updateTupleIndex);
-                ctx.modificationCallback.found(beforeTuple, tuple);
-                ctx.leafFrame.delete(tuple, updateTupleIndex);
+                ITupleReference beforeTuple = ctx.getLeafFrame().getMatchingKeyTuple(tuple, updateTupleIndex);
+                ctx.getModificationCallback().found(beforeTuple, tuple);
+                ctx.getLeafFrame().delete(tuple, updateTupleIndex);
             } else {
-                ctx.modificationCallback.found(null, tuple);
+                ctx.getModificationCallback().found(null, tuple);
             }
-            ctx.leafFrame.split(rightFrame, tuple, ctx.splitKey, ctx, bufferCache);
+            ctx.getLeafFrame().split(rightFrame, tuple, ctx.getSplitKey(), ctx, bufferCache);
 
-            ctx.smPages.add(pageId);
-            ctx.smPages.add(rightPageId);
-            ctx.leafFrame.setSmFlag(true);
+            ctx.getSmPages().add(pageId);
+            ctx.getSmPages().add(rightPageId);
+            ctx.getLeafFrame().setSmFlag(true);
             rightFrame.setSmFlag(true);
 
-            rightFrame.setNextLeaf(ctx.leafFrame.getNextLeaf());
-            ctx.leafFrame.setNextLeaf(rightPageId);
+            rightFrame.setNextLeaf(ctx.getLeafFrame().getNextLeaf());
+            ctx.getLeafFrame().setNextLeaf(rightPageId);
 
             rightFrame.setPageLsn(rightFrame.getPageLsn() + 1);
-            ctx.leafFrame.setPageLsn(ctx.leafFrame.getPageLsn() + 1);
+            ctx.getLeafFrame().setPageLsn(ctx.getLeafFrame().getPageLsn() + 1);
 
-            ctx.splitKey.setPages(pageId, rightPageId);
+            ctx.getSplitKey().setPages(pageId, rightPageId);
         } catch (Exception e) {
             treeLatch.writeLock().unlock();
             throw e;
@@ -399,43 +392,43 @@
 
     private boolean updateLeaf(ITupleReference tuple, int oldTupleIndex, int pageId, BTreeOpContext ctx)
             throws Exception {
-        FrameOpSpaceStatus spaceStatus = ctx.leafFrame.hasSpaceUpdate(tuple, oldTupleIndex);
-        ITupleReference beforeTuple = ctx.leafFrame.getMatchingKeyTuple(tuple, oldTupleIndex);
+        FrameOpSpaceStatus spaceStatus = ctx.getLeafFrame().hasSpaceUpdate(tuple, oldTupleIndex);
+        ITupleReference beforeTuple = ctx.getLeafFrame().getMatchingKeyTuple(tuple, oldTupleIndex);
         boolean restartOp = false;
         switch (spaceStatus) {
             case SUFFICIENT_INPLACE_SPACE: {
-                ctx.modificationCallback.found(beforeTuple, tuple);
-                ctx.leafFrame.update(tuple, oldTupleIndex, true);
-                ctx.splitKey.reset();
+                ctx.getModificationCallback().found(beforeTuple, tuple);
+                ctx.getLeafFrame().update(tuple, oldTupleIndex, true);
+                ctx.getSplitKey().reset();
                 break;
             }
             case EXPAND: {
                 // TODO: avoid repeated calculation of tuple size
                 // TODO: in-place update on expand
                 // Delete the old tuple, compact the frame, and insert the new tuple.
-                ctx.modificationCallback.found(beforeTuple, tuple);
-                ctx.leafFrame.delete(tuple, oldTupleIndex);
-                ctx.leafFrame.compact();
-                ctx.leafFrame.ensureCapacity(bufferCache, tuple, ctx);
-                int targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(tuple);
-                ctx.leafFrame.insert(tuple, targetTupleIndex);
-                ctx.splitKey.reset();
+                ctx.getModificationCallback().found(beforeTuple, tuple);
+                ctx.getLeafFrame().delete(tuple, oldTupleIndex);
+                ctx.getLeafFrame().compact();
+                ctx.getLeafFrame().ensureCapacity(bufferCache, tuple, ctx);
+                int targetTupleIndex = ctx.getLeafFrame().findInsertTupleIndex(tuple);
+                ctx.getLeafFrame().insert(tuple, targetTupleIndex);
+                ctx.getSplitKey().reset();
                 break;
             }
             case SUFFICIENT_CONTIGUOUS_SPACE: {
-                ctx.modificationCallback.found(beforeTuple, tuple);
-                ctx.leafFrame.update(tuple, oldTupleIndex, false);
-                ctx.splitKey.reset();
+                ctx.getModificationCallback().found(beforeTuple, tuple);
+                ctx.getLeafFrame().update(tuple, oldTupleIndex, false);
+                ctx.getSplitKey().reset();
                 break;
             }
             case SUFFICIENT_SPACE: {
                 // Delete the old tuple, compact the frame, and insert the new tuple.
-                ctx.modificationCallback.found(beforeTuple, tuple);
-                ctx.leafFrame.delete(tuple, oldTupleIndex);
-                ctx.leafFrame.compact();
-                int targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(tuple);
-                ctx.leafFrame.insert(tuple, targetTupleIndex);
-                ctx.splitKey.reset();
+                ctx.getModificationCallback().found(beforeTuple, tuple);
+                ctx.getLeafFrame().delete(tuple, oldTupleIndex);
+                ctx.getLeafFrame().compact();
+                int targetTupleIndex = ctx.getLeafFrame().findInsertTupleIndex(tuple);
+                ctx.getLeafFrame().insert(tuple, targetTupleIndex);
+                ctx.getSplitKey().reset();
                 break;
             }
             case INSUFFICIENT_SPACE: {
@@ -451,47 +444,47 @@
 
     private boolean upsertLeaf(ITupleReference tuple, int targetTupleIndex, int pageId, BTreeOpContext ctx)
             throws Exception {
-        boolean restartOp = false;
-        ITupleReference beforeTuple = ctx.leafFrame.getMatchingKeyTuple(tuple, targetTupleIndex);
-        if (ctx.acceptor.accept(beforeTuple)) {
+        boolean restartOp;
+        ITupleReference beforeTuple = ctx.getLeafFrame().getMatchingKeyTuple(tuple, targetTupleIndex);
+        if (ctx.getAcceptor().accept(beforeTuple)) {
             if (beforeTuple == null) {
                 restartOp = insertLeaf(tuple, targetTupleIndex, pageId, ctx);
             } else {
                 restartOp = updateLeaf(tuple, targetTupleIndex, pageId, ctx);
             }
         } else {
-            targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(tuple);
-            restartOp = insertLeaf(tuple, targetTupleIndex, pageId, ctx);
+            restartOp = insertLeaf(tuple, ctx.getLeafFrame().findInsertTupleIndex(tuple), pageId, ctx);
         }
         return restartOp;
     }
 
     private void insertInterior(ICachedPage node, int pageId, ITupleReference tuple, BTreeOpContext ctx)
             throws Exception {
-        ctx.interiorFrame.setPage(node);
-        int targetTupleIndex = ctx.interiorFrame.findInsertTupleIndex(tuple);
-        FrameOpSpaceStatus spaceStatus = ctx.interiorFrame.hasSpaceInsert(tuple);
+        ctx.getInteriorFrame().setPage(node);
+        int targetTupleIndex = ctx.getInteriorFrame().findInsertTupleIndex(tuple);
+        FrameOpSpaceStatus spaceStatus = ctx.getInteriorFrame().hasSpaceInsert(tuple);
         switch (spaceStatus) {
             case INSUFFICIENT_SPACE: {
-                int rightPageId = freePageManager.takePage(ctx.metaFrame);
+                int rightPageId = freePageManager.takePage(ctx.getMetaFrame());
                 ICachedPage rightNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, rightPageId), true);
                 rightNode.acquireWriteLatch();
                 try {
                     IBTreeFrame rightFrame = ctx.createInteriorFrame();
                     rightFrame.setPage(rightNode);
-                    rightFrame.initBuffer(ctx.interiorFrame.getLevel());
-                    rightFrame.setMultiComparator(ctx.cmp);
+                    rightFrame.initBuffer(ctx.getInteriorFrame().getLevel());
+                    rightFrame.setMultiComparator(ctx.getCmp());
                     // instead of creating a new split key, use the existing
                     // splitKey
-                    ctx.interiorFrame.split(rightFrame, ctx.splitKey.getTuple(), ctx.splitKey, ctx, bufferCache);
-                    ctx.smPages.add(pageId);
-                    ctx.smPages.add(rightPageId);
-                    ctx.interiorFrame.setSmFlag(true);
+                    ctx.getInteriorFrame().split(rightFrame, ctx.getSplitKey().getTuple(), ctx.getSplitKey(), ctx,
+                            bufferCache);
+                    ctx.getSmPages().add(pageId);
+                    ctx.getSmPages().add(rightPageId);
+                    ctx.getInteriorFrame().setSmFlag(true);
                     rightFrame.setSmFlag(true);
                     rightFrame.setPageLsn(rightFrame.getPageLsn() + 1);
-                    ctx.interiorFrame.setPageLsn(ctx.interiorFrame.getPageLsn() + 1);
+                    ctx.getInteriorFrame().setPageLsn(ctx.getInteriorFrame().getPageLsn() + 1);
 
-                    ctx.splitKey.setPages(pageId, rightPageId);
+                    ctx.getSplitKey().setPages(pageId, rightPageId);
                 } finally {
                     rightNode.releaseWriteLatch(true);
                     bufferCache.unpin(rightNode);
@@ -500,23 +493,23 @@
             }
 
             case SUFFICIENT_CONTIGUOUS_SPACE: {
-                ctx.interiorFrame.insert(tuple, targetTupleIndex);
-                ctx.splitKey.reset();
+                ctx.getInteriorFrame().insert(tuple, targetTupleIndex);
+                ctx.getSplitKey().reset();
                 break;
             }
 
             case SUFFICIENT_SPACE: {
-                boolean slotsChanged = ctx.interiorFrame.compact();
+                boolean slotsChanged = ctx.getInteriorFrame().compact();
                 if (slotsChanged) {
-                    targetTupleIndex = ctx.interiorFrame.findInsertTupleIndex(tuple);
+                    targetTupleIndex = ctx.getInteriorFrame().findInsertTupleIndex(tuple);
                 }
-                ctx.interiorFrame.insert(tuple, targetTupleIndex);
-                ctx.splitKey.reset();
+                ctx.getInteriorFrame().insert(tuple, targetTupleIndex);
+                ctx.getSplitKey().reset();
                 break;
             }
 
             case TOO_LARGE: {
-                int tupleSize = ctx.interiorFrame.getBytesRequiredToWriteTuple(tuple);
+                int tupleSize = ctx.getInteriorFrame().getBytesRequiredToWriteTuple(tuple);
                 throw HyracksDataException.create(ErrorCode.RECORD_IS_TOO_LARGE, tupleSize, maxTupleSize);
             }
 
@@ -531,18 +524,18 @@
         // Simply delete the tuple, and don't do any rebalancing.
         // This means that there could be underflow, even an empty page that is
         // pointed to by an interior node.
-        if (ctx.leafFrame.getTupleCount() == 0) {
+        if (ctx.getLeafFrame().getTupleCount() == 0) {
             throw HyracksDataException.create(ErrorCode.UPDATE_OR_DELETE_NON_EXISTENT_KEY);
         }
-        int tupleIndex = ctx.leafFrame.findDeleteTupleIndex(tuple);
-        ITupleReference beforeTuple = ctx.leafFrame.getMatchingKeyTuple(tuple, tupleIndex);
-        ctx.modificationCallback.found(beforeTuple, tuple);
-        ctx.leafFrame.delete(tuple, tupleIndex);
+        int tupleIndex = ctx.getLeafFrame().findDeleteTupleIndex(tuple);
+        ITupleReference beforeTuple = ctx.getLeafFrame().getMatchingKeyTuple(tuple, tupleIndex);
+        ctx.getModificationCallback().found(beforeTuple, tuple);
+        ctx.getLeafFrame().delete(tuple, tupleIndex);
         return false;
     }
 
     private final boolean acquireLatch(ICachedPage node, BTreeOpContext ctx, boolean isLeaf) {
-        if (!isLeaf || (ctx.op == IndexOperation.SEARCH && !ctx.cursor.exclusiveLatchNodes())) {
+        if (!isLeaf || (ctx.getOperation() == IndexOperation.SEARCH && !ctx.getCursor().exclusiveLatchNodes())) {
             node.acquireReadLatch();
             return true;
         } else {
@@ -554,8 +547,8 @@
     private ICachedPage isConsistent(int pageId, BTreeOpContext ctx) throws Exception {
         ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
         node.acquireReadLatch();
-        ctx.interiorFrame.setPage(node);
-        boolean isConsistent = ctx.pageLsns.getLast() == ctx.interiorFrame.getPageLsn();
+        ctx.getInteriorFrame().setPage(node);
+        boolean isConsistent = ctx.getPageLsns().getLast() == ctx.getInteriorFrame().getPageLsn();
         if (!isConsistent) {
             node.releaseReadLatch();
             bufferCache.unpin(node);
@@ -567,18 +560,18 @@
     private void performOp(int pageId, ICachedPage parent, boolean parentIsReadLatched, BTreeOpContext ctx)
             throws HyracksDataException {
         ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-        ctx.interiorFrame.setPage(node);
+        ctx.getInteriorFrame().setPage(node);
         // this check performs an unprotected read in the page
         // the following could happen: TODO fill out
-        boolean unsafeIsLeaf = ctx.interiorFrame.isLeaf();
+        boolean unsafeIsLeaf = ctx.getInteriorFrame().isLeaf();
         boolean isReadLatched = acquireLatch(node, ctx, unsafeIsLeaf);
-        boolean smFlag = ctx.interiorFrame.getSmFlag();
+        boolean smFlag = ctx.getInteriorFrame().getSmFlag();
         // re-check leafness after latching
-        boolean isLeaf = ctx.interiorFrame.isLeaf();
+        boolean isLeaf = ctx.getInteriorFrame().isLeaf();
 
         // remember trail of pageLsns, to unwind recursion in case of an ongoing
         // structure modification
-        ctx.pageLsns.add(ctx.interiorFrame.getPageLsn());
+        ctx.getPageLsns().add(ctx.getInteriorFrame().getPageLsn());
         try {
             // Latch coupling: unlatch parent.
             if (parent != null) {
@@ -595,17 +588,17 @@
                     // restarts due to ongoing structure modifications during
                     // the descent.
                     boolean repeatOp = true;
-                    while (repeatOp && ctx.opRestarts < MAX_RESTARTS) {
-                        int childPageId = ctx.interiorFrame.getChildPageId(ctx.pred);
+                    while (repeatOp && ctx.getOpRestarts() < MAX_RESTARTS) {
+                        int childPageId = ctx.getInteriorFrame().getChildPageId(ctx.getPred());
                         performOp(childPageId, node, isReadLatched, ctx);
                         node = null;
 
-                        if (!ctx.pageLsns.isEmpty()) {
-                            if (ctx.pageLsns.getLast() == FULL_RESTART_OP) {
+                        if (!ctx.getPageLsns().isEmpty()) {
+                            if (ctx.getPageLsns().getLast() == FULL_RESTART_OP) {
                                 break;
-                            } else if (ctx.pageLsns.getLast() == RESTART_OP) {
+                            } else if (ctx.getPageLsns().getLast() == RESTART_OP) {
                                 // Pop the restart op indicator.
-                                ctx.pageLsns.removeLast();
+                                ctx.getPageLsns().removeLast();
                                 node = isConsistent(pageId, ctx);
                                 if (node != null) {
                                     isReadLatched = true;
@@ -613,26 +606,26 @@
                                     continue;
                                 } else {
                                     // Pop pageLsn of this page (version seen by this op during descent).
-                                    ctx.pageLsns.removeLast();
+                                    ctx.getPageLsns().removeLast();
                                     // This node is not consistent set the restart indicator for upper level.
-                                    ctx.pageLsns.add(RESTART_OP);
+                                    ctx.getPageLsns().add(RESTART_OP);
                                     break;
                                 }
                             }
                         }
 
-                        switch (ctx.op) {
+                        switch (ctx.getOperation()) {
                             case INSERT:
                             case UPSERT:
                             case UPDATE: {
                                 // Is there a propagated split key?
-                                if (ctx.splitKey.getBuffer() != null) {
+                                if (ctx.getSplitKey().getBuffer() != null) {
                                     ICachedPage interiorNode =
                                             bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
                                     interiorNode.acquireWriteLatch();
                                     try {
                                         // Insert or update op. Both can cause split keys to propagate upwards.
-                                        insertInterior(interiorNode, pageId, ctx.splitKey.getTuple(), ctx);
+                                        insertInterior(interiorNode, pageId, ctx.getSplitKey().getTuple(), ctx);
                                     } finally {
                                         interiorNode.releaseWriteLatch(true);
                                         bufferCache.unpin(interiorNode);
@@ -644,7 +637,7 @@
                             }
 
                             case DELETE: {
-                                if (ctx.splitKey.getBuffer() != null) {
+                                if (ctx.getSplitKey().getBuffer() != null) {
                                     throw new HyracksDataException(
                                             "Split key was propagated during delete. Delete allows empty leaf pages.");
                                 }
@@ -660,7 +653,7 @@
                         repeatOp = false;
                     } // end while
                 } else { // smFlag
-                    ctx.opRestarts++;
+                    ctx.setOpRestarts(ctx.getOpRestarts() + 1);
                     if (isReadLatched) {
                         node.releaseReadLatch();
                     } else {
@@ -678,45 +671,45 @@
 
                     // unwind recursion and restart operation, find lowest page
                     // with a pageLsn as seen by this operation during descent
-                    ctx.pageLsns.removeLast(); // pop current page lsn
+                    ctx.getPageLsns().removeLast(); // pop current page lsn
                     // put special value on the stack to inform caller of
                     // restart
-                    ctx.pageLsns.add(RESTART_OP);
+                    ctx.getPageLsns().add(RESTART_OP);
                 }
             } else { // isLeaf and !smFlag
                 // We may have to restart an op to avoid latch deadlock.
                 boolean restartOp = false;
-                ctx.leafFrame.setPage(node);
-                switch (ctx.op) {
+                ctx.getLeafFrame().setPage(node);
+                switch (ctx.getOperation()) {
                     case INSERT: {
-                        int targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(ctx.pred.getLowKey());
-                        restartOp = insertLeaf(ctx.pred.getLowKey(), targetTupleIndex, pageId, ctx);
+                        int targetTupleIndex = ctx.getLeafFrame().findInsertTupleIndex(ctx.getPred().getLowKey());
+                        restartOp = insertLeaf(ctx.getPred().getLowKey(), targetTupleIndex, pageId, ctx);
                         break;
                     }
                     case UPSERT: {
-                        int targetTupleIndex = ctx.leafFrame.findUpsertTupleIndex(ctx.pred.getLowKey());
-                        restartOp = upsertLeaf(ctx.pred.getLowKey(), targetTupleIndex, pageId, ctx);
+                        int targetTupleIndex = ctx.getLeafFrame().findUpsertTupleIndex(ctx.getPred().getLowKey());
+                        restartOp = upsertLeaf(ctx.getPred().getLowKey(), targetTupleIndex, pageId, ctx);
                         break;
                     }
                     case UPDATE: {
-                        int oldTupleIndex = ctx.leafFrame.findUpdateTupleIndex(ctx.pred.getLowKey());
-                        restartOp = updateLeaf(ctx.pred.getLowKey(), oldTupleIndex, pageId, ctx);
+                        int oldTupleIndex = ctx.getLeafFrame().findUpdateTupleIndex(ctx.getPred().getLowKey());
+                        restartOp = updateLeaf(ctx.getPred().getLowKey(), oldTupleIndex, pageId, ctx);
                         break;
                     }
                     case DELETE: {
-                        restartOp = deleteLeaf(node, pageId, ctx.pred.getLowKey(), ctx);
+                        restartOp = deleteLeaf(node, pageId, ctx.getPred().getLowKey(), ctx);
                         break;
                     }
                     case SEARCH: {
-                        ctx.cursorInitialState.setSearchOperationCallback(ctx.searchCallback);
-                        ctx.cursorInitialState.setOriginialKeyComparator(ctx.cmp);
-                        ctx.cursorInitialState.setPage(node);
-                        ctx.cursorInitialState.setPageId(pageId);
-                        ctx.cursor.open(ctx.cursorInitialState, ctx.pred);
+                        ctx.getCursorInitialState().setSearchOperationCallback(ctx.getSearchCallback());
+                        ctx.getCursorInitialState().setOriginialKeyComparator(ctx.getCmp());
+                        ctx.getCursorInitialState().setPage(node);
+                        ctx.getCursorInitialState().setPageId(pageId);
+                        ctx.getCursor().open(ctx.getCursorInitialState(), ctx.getPred());
                         break;
                     }
                 }
-                if (ctx.op != IndexOperation.SEARCH) {
+                if (ctx.getOperation() != IndexOperation.SEARCH) {
                     node.releaseWriteLatch(true);
                     bufferCache.unpin(node);
                 }
@@ -724,12 +717,12 @@
                     // Wait for the SMO to persistFrontiers before restarting.
                     treeLatch.readLock().lock();
                     treeLatch.readLock().unlock();
-                    ctx.pageLsns.removeLast();
-                    ctx.pageLsns.add(FULL_RESTART_OP);
+                    ctx.getPageLsns().removeLast();
+                    ctx.getPageLsns().add(FULL_RESTART_OP);
                 }
             }
         } catch (HyracksDataException e) {
-            if (!ctx.exceptionHandled) {
+            if (!ctx.isExceptionHandled()) {
                 if (node != null) {
                     if (isReadLatched) {
                         node.releaseReadLatch();
@@ -737,7 +730,7 @@
                         node.releaseWriteLatch(true);
                     }
                     bufferCache.unpin(node);
-                    ctx.exceptionHandled = true;
+                    ctx.setExceptionHandled(true);
                 }
             }
             throw e;
@@ -751,7 +744,7 @@
                 bufferCache.unpin(node);
             }
             HyracksDataException wrappedException = HyracksDataException.create(e);
-            ctx.exceptionHandled = true;
+            ctx.setExceptionHandled(true);
             throw wrappedException;
         }
     }
@@ -874,7 +867,7 @@
         public void upsertIfConditionElseInsert(ITupleReference tuple, ITupleAcceptor acceptor)
                 throws HyracksDataException {
             ctx.setOperation(IndexOperation.UPSERT);
-            ctx.acceptor = acceptor;
+            ctx.setAcceptor(acceptor);
             upsert(tuple, ctx);
         }
 
@@ -915,12 +908,12 @@
         }
 
         private void insert(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException {
-            ctx.modificationCallback.before(tuple);
+            ctx.getModificationCallback().before(tuple);
             insertUpdateOrDelete(tuple, ctx);
         }
 
         private void upsert(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException {
-            ctx.modificationCallback.before(tuple);
+            ctx.getModificationCallback().before(tuple);
             insertUpdateOrDelete(tuple, ctx);
         }
 
@@ -928,45 +921,45 @@
             // This call only allows updating of non-key fields.
             // Updating a tuple's key necessitates deleting the old entry, and inserting the new entry.
             // The user of the BTree is responsible for dealing with non-key updates (i.e., doing a delete + insert).
-            if (fieldCount == ctx.cmp.getKeyFieldCount()) {
+            if (fieldCount == ctx.getCmp().getKeyFieldCount()) {
                 HyracksDataException.create(ErrorCode.INDEX_NOT_UPDATABLE);
             }
-            ctx.modificationCallback.before(tuple);
+            ctx.getModificationCallback().before(tuple);
             insertUpdateOrDelete(tuple, ctx);
         }
 
         private void delete(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException {
-            ctx.modificationCallback.before(tuple);
+            ctx.getModificationCallback().before(tuple);
             insertUpdateOrDelete(tuple, ctx);
         }
 
         private void insertUpdateOrDelete(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException {
             ctx.reset();
-            ctx.pred.setLowKeyComparator(ctx.cmp);
-            ctx.pred.setHighKeyComparator(ctx.cmp);
-            ctx.pred.setLowKey(tuple, true);
-            ctx.pred.setHighKey(tuple, true);
-            ctx.splitKey.reset();
-            ctx.splitKey.getTuple().setFieldCount(ctx.cmp.getKeyFieldCount());
+            ctx.getPred().setLowKeyComparator(ctx.getCmp());
+            ctx.getPred().setHighKeyComparator(ctx.getCmp());
+            ctx.getPred().setLowKey(tuple, true);
+            ctx.getPred().setHighKey(tuple, true);
+            ctx.getSplitKey().reset();
+            ctx.getSplitKey().getTuple().setFieldCount(ctx.getCmp().getKeyFieldCount());
             // We use this loop to deal with possibly multiple operation restarts
             // due to ongoing structure modifications during the descent.
             boolean repeatOp = true;
-            while (repeatOp && ctx.opRestarts < MAX_RESTARTS) {
-                ctx.smoCount = smoCounter.get();
+            while (repeatOp && ctx.getOpRestarts() < MAX_RESTARTS) {
+                ctx.setSmoCount(smoCounter.get());
                 performOp(rootPage, null, true, ctx);
                 // Do we need to restart from the (possibly new) root?
-                if (!ctx.pageLsns.isEmpty()) {
-                    if (ctx.pageLsns.getLast() == FULL_RESTART_OP) {
-                        ctx.pageLsns.clear();
+                if (!ctx.getPageLsns().isEmpty()) {
+                    if (ctx.getPageLsns().getLast() == FULL_RESTART_OP) {
+                        ctx.getPageLsns().clear();
                         continue;
-                    } else if (ctx.pageLsns.getLast() == RESTART_OP) {
-                        ctx.pageLsns.removeLast(); // pop the restart op indicator
+                    } else if (ctx.getPageLsns().getLast() == RESTART_OP) {
+                        ctx.getPageLsns().removeLast(); // pop the restart op indicator
                         continue;
                     }
 
                 }
                 // Split key propagated?
-                if (ctx.splitKey.getBuffer() != null) {
+                if (ctx.getSplitKey().getBuffer() != null) {
                     // Insert or update op. Create a new root.
                     createNewRoot(ctx);
                 }
@@ -974,7 +967,7 @@
                 repeatOp = false;
             }
 
-            if (ctx.opRestarts >= MAX_RESTARTS) {
+            if (ctx.getOpRestarts() >= MAX_RESTARTS) {
                 throw HyracksDataException.create(ErrorCode.OPERATION_EXCEEDED_MAX_RESTARTS, MAX_RESTARTS);
             }
         }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
index dff6743..079de74 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
@@ -31,10 +31,10 @@
 import org.apache.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
 import org.apache.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import org.apache.hyracks.storage.am.btree.api.ITupleAcceptor;
-import org.apache.hyracks.storage.am.common.api.IPageManager;
 import org.apache.hyracks.storage.am.common.api.IIndexAccessor;
 import org.apache.hyracks.storage.am.common.api.IIndexOperationContext;
 import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback;
+import org.apache.hyracks.storage.am.common.api.IPageManager;
 import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
@@ -47,40 +47,39 @@
 import org.apache.hyracks.storage.common.buffercache.IExtraPageBlockHelper;
 
 public class BTreeOpContext implements IIndexOperationContext, IExtraPageBlockHelper {
-    private final int INIT_ARRAYLIST_SIZE = 6;
+    private static final int INIT_ARRAYLIST_SIZE = 6;
 
-    public IIndexAccessor accessor;
-    public MultiComparator cmp;
-    public ITreeIndexFrameFactory leafFrameFactory;
-    public ITreeIndexFrameFactory interiorFrameFactory;
-    public IBTreeLeafFrame leafFrame;
-    public IBTreeInteriorFrame interiorFrame;
-    public final IPageManager freePageManager;
-    public final ITreeIndexMetadataFrame metaFrame;
-    public IndexOperation op;
-    public ITreeIndexCursor cursor;
-    public BTreeCursorInitialState cursorInitialState;
-    public RangePredicate pred;
-    public BTreeSplitKey splitKey;
-    public LongArrayList pageLsns;
-    public IntArrayList smPages;
-    public IntArrayList freePages;
-    public int opRestarts = 0;
-    public boolean exceptionHandled;
-    public IModificationOperationCallback modificationCallback;
-    public ISearchOperationCallback searchCallback;
-    public ITupleAcceptor acceptor;
-    public int smoCount;
+    private final IIndexAccessor accessor;
+    private final MultiComparator cmp;
+    private final ITreeIndexFrameFactory interiorFrameFactory;
+    private final IBTreeInteriorFrame interiorFrame;
+    private final IPageManager freePageManager;
+    private final ITreeIndexMetadataFrame metaFrame;
+    private ITreeIndexFrameFactory leafFrameFactory;
+    private IBTreeLeafFrame leafFrame;
+    private IndexOperation op;
+    private ITreeIndexCursor cursor;
+    private BTreeCursorInitialState cursorInitialState;
+    private RangePredicate pred;
+    private BTreeSplitKey splitKey;
+    private LongArrayList pageLsns;
+    private IntArrayList smPages;
+    private IntArrayList freePages;
+    private int opRestarts = 0;
+    private boolean exceptionHandled;
+    private IModificationOperationCallback modificationCallback;
+    private ISearchOperationCallback searchCallback;
+    private ITupleAcceptor acceptor;
+    private int smoCount;
 
     // Debug
-    public final Deque<PageValidationInfo> validationInfos;
-    public final ITreeIndexTupleReference interiorFrameTuple;
-    public final ITreeIndexTupleReference leafFrameTuple;
+    private final Deque<PageValidationInfo> validationInfos;
+    private final ITreeIndexTupleReference interiorFrameTuple;
 
     public BTreeOpContext(IIndexAccessor accessor, ITreeIndexFrameFactory leafFrameFactory,
             ITreeIndexFrameFactory interiorFrameFactory, IPageManager freePageManager,
-                          IBinaryComparatorFactory[] cmpFactories, IModificationOperationCallback modificationCallback,
-                          ISearchOperationCallback searchCallback) {
+            IBinaryComparatorFactory[] cmpFactories, IModificationOperationCallback modificationCallback,
+            ISearchOperationCallback searchCallback) {
         this.accessor = accessor;
 
         if (cmpFactories[0] != null) {
@@ -90,15 +89,15 @@
             this.cmp = null;
         }
 
-        this.leafFrameFactory = leafFrameFactory;
+        this.setLeafFrameFactory(leafFrameFactory);
         this.leafFrame = (IBTreeLeafFrame) leafFrameFactory.createFrame();
-        if (leafFrame != null && this.cmp != null) {
-            leafFrame.setMultiComparator(cmp);
+        if (getLeafFrame() != null && this.getCmp() != null) {
+            getLeafFrame().setMultiComparator(getCmp());
         }
         this.interiorFrameFactory = interiorFrameFactory;
         this.interiorFrame = (IBTreeInteriorFrame) interiorFrameFactory.createFrame();
-        if (interiorFrame != null && this.cmp != null) {
-            interiorFrame.setMultiComparator(cmp);
+        if (getInteriorFrame() != null && this.getCmp() != null) {
+            getInteriorFrame().setMultiComparator(getCmp());
         }
         this.freePageManager = freePageManager;
         this.metaFrame = freePageManager.createMetadataFrame();
@@ -109,8 +108,7 @@
 
         // Debug
         this.validationInfos = new ArrayDeque<>(INIT_ARRAYLIST_SIZE);
-        this.interiorFrameTuple = interiorFrame.createTupleReference();
-        this.leafFrameTuple = leafFrame.createTupleReference();
+        this.interiorFrameTuple = getInteriorFrame().createTupleReference();
     }
 
     @Override
@@ -143,11 +141,11 @@
             if (freePages == null) {
                 freePages = new IntArrayList(INIT_ARRAYLIST_SIZE, INIT_ARRAYLIST_SIZE);
             }
-            if (pred == null) {
-                pred = new RangePredicate(null, null, true, true, null, null);
+            if (getPred() == null) {
+                setPred(new RangePredicate(null, null, true, true, null, null));
             }
             if (splitKey == null) {
-                splitKey = new BTreeSplitKey(leafFrame.getTupleWriter().createTupleReference());
+                splitKey = new BTreeSplitKey(getLeafFrame().getTupleWriter().createTupleReference());
             }
         }
         op = newOp;
@@ -156,7 +154,7 @@
     }
 
     public IBTreeLeafFrame createLeafFrame() {
-        return (IBTreeLeafFrame) leafFrameFactory.createFrame();
+        return (IBTreeLeafFrame) getLeafFrameFactory().createFrame();
     }
 
     public IBTreeInteriorFrame createInteriorFrame() {
@@ -179,7 +177,7 @@
         public boolean isHighRangeNull;
 
         public PageValidationInfo() {
-            this.numKeyFields = cmp.getKeyFieldCount();
+            this.numKeyFields = getCmp().getKeyFieldCount();
             this.lowRangeBuilder = new ArrayTupleBuilder(numKeyFields);
             this.highRangeBuilder = new ArrayTupleBuilder(numKeyFields);
             this.lowRangeTuple = new ArrayTupleReference();
@@ -240,15 +238,130 @@
             ISearchOperationCallback searchCallback) {
         this.modificationCallback = modificationCallback;
         this.searchCallback = searchCallback;
+        if (cursorInitialState != null) {
+            cursorInitialState.setSearchOperationCallback(searchCallback);
+        }
     }
 
     @Override
     public int getFreeBlock(int size) throws HyracksDataException {
-        return freePageManager.takeBlock(metaFrame, size);
+        return freePageManager.takeBlock(getMetaFrame(), size);
     }
 
     @Override
     public void returnFreePageBlock(int blockPageId, int size) throws HyracksDataException {
-        freePageManager.releaseBlock(metaFrame, blockPageId, size);
+        freePageManager.releaseBlock(getMetaFrame(), blockPageId, size);
+    }
+
+    public ITreeIndexMetadataFrame getMetaFrame() {
+        return metaFrame;
+    }
+
+    public ISearchOperationCallback getSearchCallback() {
+        return searchCallback;
+    }
+
+    public Deque<PageValidationInfo> getValidationInfos() {
+        return validationInfos;
+    }
+
+    public IBTreeLeafFrame getLeafFrame() {
+        return leafFrame;
+    }
+
+    public ITreeIndexTupleReference getInteriorFrameTuple() {
+        return interiorFrameTuple;
+    }
+
+    public RangePredicate getPred() {
+        return pred;
+    }
+
+    public void setPred(RangePredicate pred) {
+        this.pred = pred;
+    }
+
+    public ITreeIndexCursor getCursor() {
+        return cursor;
+    }
+
+    public void setCursor(ITreeIndexCursor cursor) {
+        this.cursor = cursor;
+    }
+
+    public int getOpRestarts() {
+        return opRestarts;
+    }
+
+    public LongArrayList getPageLsns() {
+        return pageLsns;
+    }
+
+    public void setPageLsns(LongArrayList pageLsns) {
+        this.pageLsns = pageLsns;
+    }
+
+    public IntArrayList getSmPages() {
+        return smPages;
+    }
+
+    public IBTreeInteriorFrame getInteriorFrame() {
+        return interiorFrame;
+    }
+
+    public int getSmoCount() {
+        return smoCount;
+    }
+
+    public BTreeSplitKey getSplitKey() {
+        return splitKey;
+    }
+
+    public IModificationOperationCallback getModificationCallback() {
+        return modificationCallback;
+    }
+
+    public MultiComparator getCmp() {
+        return cmp;
+    }
+
+    public ITupleAcceptor getAcceptor() {
+        return acceptor;
+    }
+
+    public void setOpRestarts(int opRestarts) {
+        this.opRestarts = opRestarts;
+    }
+
+    public BTreeCursorInitialState getCursorInitialState() {
+        return cursorInitialState;
+    }
+
+    public boolean isExceptionHandled() {
+        return exceptionHandled;
+    }
+
+    public void setExceptionHandled(boolean exceptionHandled) {
+        this.exceptionHandled = exceptionHandled;
+    }
+
+    public void setAcceptor(ITupleAcceptor acceptor) {
+        this.acceptor = acceptor;
+    }
+
+    public void setSmoCount(int smoCount) {
+        this.smoCount = smoCount;
+    }
+
+    public void setLeafFrame(IBTreeLeafFrame leafFrame) {
+        this.leafFrame = leafFrame;
+    }
+
+    public ITreeIndexFrameFactory getLeafFrameFactory() {
+        return leafFrameFactory;
+    }
+
+    public void setLeafFrameFactory(ITreeIndexFrameFactory leafFrameFactory) {
+        this.leafFrameFactory = leafFrameFactory;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTree.java
index 90faa91..c3636d6 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTree.java
@@ -154,8 +154,8 @@
             throws HyracksDataException {
         ExternalBTreeOpContext ctx = (ExternalBTreeOpContext) ictx;
         List<ILSMComponent> operationalComponents = ctx.getComponentHolder();
-        ctx.searchInitialState.reset(pred, operationalComponents);
-        cursor.open(ctx.searchInitialState, pred);
+        ctx.getSearchInitialState().reset(pred, operationalComponents);
+        cursor.open(ctx.getSearchInitialState(), pred);
     }
 
     // This method creates the appropriate opContext for the targeted version
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeOpContext.java
index 5f867db..cb64272 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeOpContext.java
@@ -29,26 +29,24 @@
 import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext;
 
 public class ExternalBTreeOpContext extends AbstractLSMIndexOperationContext {
-    public ITreeIndexFrameFactory insertLeafFrameFactory;
-    public ITreeIndexFrameFactory deleteLeafFrameFactory;
-    public IBTreeLeafFrame insertLeafFrame;
-    public IBTreeLeafFrame deleteLeafFrame;
-    public IndexOperation op;
-    public final MultiComparator cmp;
-    public final MultiComparator bloomFilterCmp;
-    public final ISearchOperationCallback searchCallback;
+    private IBTreeLeafFrame insertLeafFrame;
+    private IBTreeLeafFrame deleteLeafFrame;
+    private IndexOperation op;
+    private final MultiComparator cmp;
+    private final MultiComparator bloomFilterCmp;
+    private final ISearchOperationCallback searchCallback;
     private final List<ILSMComponent> componentHolder;
     private final List<ILSMDiskComponent> componentsToBeMerged;
     private final List<ILSMDiskComponent> componentsToBeReplicated;
     private final int targetIndexVersion;
-    public ISearchPredicate searchPredicate;
-    public LSMBTreeCursorInitialState searchInitialState;
+    private ISearchPredicate searchPredicate;
+    private LSMBTreeCursorInitialState searchInitialState;
 
     public ExternalBTreeOpContext(ITreeIndexFrameFactory insertLeafFrameFactory,
             ITreeIndexFrameFactory deleteLeafFrameFactory, ISearchOperationCallback searchCallback,
@@ -60,8 +58,6 @@
             this.cmp = null;
         }
         bloomFilterCmp = MultiComparator.create(cmpFactories, 0, numBloomFilterKeyFields);
-        this.insertLeafFrameFactory = insertLeafFrameFactory;
-        this.deleteLeafFrameFactory = deleteLeafFrameFactory;
         this.insertLeafFrame = (IBTreeLeafFrame) insertLeafFrameFactory.createFrame();
         this.deleteLeafFrame = (IBTreeLeafFrame) deleteLeafFrameFactory.createFrame();
         if (insertLeafFrame != null && this.cmp != null) {
@@ -144,4 +140,7 @@
         return componentsToBeReplicated;
     }
 
+    public LSMBTreeCursorInitialState getSearchInitialState() {
+        return searchInitialState;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddy.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddy.java
index 3be596c..4316c3d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddy.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddy.java
@@ -311,8 +311,8 @@
             throws HyracksDataException {
         ExternalBTreeWithBuddyOpContext ctx = (ExternalBTreeWithBuddyOpContext) ictx;
         List<ILSMComponent> operationalComponents = ictx.getComponentHolder();
-        ctx.searchInitialState.setOperationalComponents(operationalComponents);
-        cursor.open(ctx.searchInitialState, pred);
+        ctx.getSearchInitialState().setOperationalComponents(operationalComponents);
+        cursor.open(ctx.getSearchInitialState(), pred);
     }
 
     @Override
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddyOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddyOpContext.java
index 051b655..131ede2 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddyOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/ExternalBTreeWithBuddyOpContext.java
@@ -29,8 +29,8 @@
 import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback;
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext;
 
@@ -38,13 +38,13 @@
     private IndexOperation op;
     private MultiComparator bTreeCmp;
     private MultiComparator buddyBTreeCmp;
-    public final List<ILSMComponent> componentHolder;
+    private final List<ILSMComponent> componentHolder;
     private final List<ILSMDiskComponent> componentsToBeMerged;
     private final List<ILSMDiskComponent> componentsToBeReplicated;
-    public final ISearchOperationCallback searchCallback;
+    private final ISearchOperationCallback searchCallback;
     private final int targetIndexVersion;
-    public ISearchPredicate searchPredicate;
-    public LSMBTreeWithBuddyCursorInitialState searchInitialState;
+    private ISearchPredicate searchPredicate;
+    private LSMBTreeWithBuddyCursorInitialState searchInitialState;
 
     public ExternalBTreeWithBuddyOpContext(IBinaryComparatorFactory[] btreeCmpFactories,
             IBinaryComparatorFactory[] buddyBtreeCmpFactories, ISearchOperationCallback searchCallback,
@@ -133,4 +133,8 @@
     public List<ILSMDiskComponent> getComponentsToBeReplicated() {
         return componentsToBeReplicated;
     }
+
+    public LSMBTreeWithBuddyCursorInitialState getSearchInitialState() {
+        return searchInitialState;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
index 04c895f..22dbd83 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
@@ -290,7 +290,7 @@
                         if (c.getLSMComponentFilter().satisfy(
                                 ((AbstractSearchPredicate) ctx.getSearchPredicate()).getMinFilterTuple(),
                                 ((AbstractSearchPredicate) ctx.getSearchPredicate()).getMaxFilterTuple(),
-                                ((LSMBTreeOpContext) ctx).filterCmp)) {
+                                ((LSMBTreeOpContext) ctx).getFilterCmp())) {
                             operationalComponents.add(c);
                         }
                     }
@@ -318,40 +318,40 @@
         LSMBTreeOpContext ctx = (LSMBTreeOpContext) ictx;
 
         ITupleReference indexTuple;
-        if (ctx.indexTuple != null) {
-            ctx.indexTuple.reset(tuple);
-            indexTuple = ctx.indexTuple;
+        if (ctx.getIndexTuple() != null) {
+            ctx.getIndexTuple().reset(tuple);
+            indexTuple = ctx.getIndexTuple();
         } else {
             indexTuple = tuple;
         }
 
         switch (ctx.getOperation()) {
             case PHYSICALDELETE:
-                ctx.currentMutableBTreeAccessor.delete(indexTuple);
+                ctx.getCurrentMutableBTreeAccessor().delete(indexTuple);
                 break;
             case INSERT:
                 insert(indexTuple, ctx);
                 break;
             default:
-                ctx.currentMutableBTreeAccessor.upsert(indexTuple);
+                ctx.getCurrentMutableBTreeAccessor().upsert(indexTuple);
                 break;
         }
-        if (ctx.filterTuple != null) {
-            ctx.filterTuple.reset(tuple);
-            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.filterTuple,
-                    ctx.filterCmp);
+        if (ctx.getFilterTuple() != null) {
+            ctx.getFilterTuple().reset(tuple);
+            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.getFilterTuple(),
+                    ctx.getFilterCmp());
         }
     }
 
     private boolean insert(ITupleReference tuple, LSMBTreeOpContext ctx) throws HyracksDataException {
-        LSMBTreePointSearchCursor searchCursor = ctx.insertSearchCursor;
-        IIndexCursor memCursor = ctx.memCursor;
+        LSMBTreePointSearchCursor searchCursor = ctx.getInsertSearchCursor();
+        IIndexCursor memCursor = ctx.getMemCursor();
         RangePredicate predicate = (RangePredicate) ctx.getSearchPredicate();
         predicate.setHighKey(tuple);
         predicate.setLowKey(tuple);
         if (needKeyDupCheck) {
             // first check the inmemory component
-            ctx.currentMutableBTreeAccessor.search(memCursor, predicate);
+            ctx.getCurrentMutableBTreeAccessor().search(memCursor, predicate);
             try {
                 if (memCursor.hasNext()) {
                     memCursor.next();
@@ -360,7 +360,7 @@
                         throw HyracksDataException.create(ErrorCode.DUPLICATE_KEY);
                     } else {
                         memCursor.close();
-                        ctx.currentMutableBTreeAccessor.upsertIfConditionElseInsert(tuple,
+                        ctx.getCurrentMutableBTreeAccessor().upsertIfConditionElseInsert(tuple,
                                 AntimatterAwareTupleAcceptor.INSTANCE);
                         return true;
                     }
@@ -389,7 +389,7 @@
                 ctx.getComponentHolder().add(0, firstComponent);
             }
         }
-        ctx.currentMutableBTreeAccessor.upsertIfConditionElseInsert(tuple, AntimatterAwareTupleAcceptor.INSTANCE);
+        ctx.getCurrentMutableBTreeAccessor().upsertIfConditionElseInsert(tuple, AntimatterAwareTupleAcceptor.INSTANCE);
         return true;
     }
 
@@ -398,8 +398,8 @@
             throws HyracksDataException {
         LSMBTreeOpContext ctx = (LSMBTreeOpContext) ictx;
         List<ILSMComponent> operationalComponents = ctx.getComponentHolder();
-        ctx.searchInitialState.reset(pred, operationalComponents);
-        cursor.open(ctx.searchInitialState, pred);
+        ctx.getSearchInitialState().reset(pred, operationalComponents);
+        cursor.open(ctx.getSearchInitialState(), pred);
     }
 
     @Override
@@ -768,7 +768,7 @@
 
         public MultiComparator getMultiComparator() {
             LSMBTreeOpContext concreteCtx = (LSMBTreeOpContext) ctx;
-            return concreteCtx.cmp;
+            return concreteCtx.getCmp();
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
index 6dafe43..905ef99 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
@@ -36,43 +36,49 @@
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
 import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent;
 import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext;
 
 public final class LSMBTreeOpContext extends AbstractLSMIndexOperationContext {
 
-    public ITreeIndexFrameFactory insertLeafFrameFactory;
-    public ITreeIndexFrameFactory deleteLeafFrameFactory;
-    public IBTreeLeafFrame insertLeafFrame;
-    public IBTreeLeafFrame deleteLeafFrame;
-    public final BTree[] mutableBTrees;
-    public BTree.BTreeAccessor[] mutableBTreeAccessors;
-    public BTreeOpContext[] mutableBTreeOpCtxs;
-    public BTree.BTreeAccessor currentMutableBTreeAccessor;
-    public BTreeOpContext currentMutableBTreeOpCtx;
-    public IndexOperation op;
-    public final MultiComparator cmp;
-    public final MultiComparator bloomFilterCmp;
-    public IModificationOperationCallback modificationCallback;
-    public ISearchOperationCallback searchCallback;
+    /*
+     * Finals
+     */
+    private final ITreeIndexFrameFactory insertLeafFrameFactory;
+    private final ITreeIndexFrameFactory deleteLeafFrameFactory;
+    private final IBTreeLeafFrame insertLeafFrame;
+    private final IBTreeLeafFrame deleteLeafFrame;
+    private final BTree[] mutableBTrees;
+    private final BTree.BTreeAccessor[] mutableBTreeAccessors;
+    private final BTreeOpContext[] mutableBTreeOpCtxs;
+    private final MultiComparator cmp;
+    private final MultiComparator bloomFilterCmp;
+    private final IModificationOperationCallback modificationCallback;
+    private final ISearchOperationCallback searchCallback;
     private final List<ILSMComponent> componentHolder;
     private final List<ILSMDiskComponent> componentsToBeMerged;
     private final List<ILSMDiskComponent> componentsToBeReplicated;
-    public final PermutingTupleReference indexTuple;
-    public final MultiComparator filterCmp;
-    public final PermutingTupleReference filterTuple;
-    public ISearchPredicate searchPredicate;
-    public BTreeRangeSearchCursor memCursor;
-    public LSMBTreeCursorInitialState searchInitialState;
-    public LSMBTreePointSearchCursor insertSearchCursor;
+    private final PermutingTupleReference indexTuple;
+    private final MultiComparator filterCmp;
+    private final PermutingTupleReference filterTuple;
+    private final BTreeRangeSearchCursor memCursor;
+    private final LSMBTreeCursorInitialState searchInitialState;
+    private final LSMBTreePointSearchCursor insertSearchCursor;
+    /*
+     * Mutables
+     */
+    private BTree.BTreeAccessor currentMutableBTreeAccessor;
+    private BTreeOpContext currentMutableBTreeOpCtx;
+    private IndexOperation op;
+    private ISearchPredicate searchPredicate;
 
     public LSMBTreeOpContext(List<ILSMMemoryComponent> mutableComponents, ITreeIndexFrameFactory insertLeafFrameFactory,
             ITreeIndexFrameFactory deleteLeafFrameFactory, IModificationOperationCallback modificationCallback,
-            ISearchOperationCallback searchCallback, int numBloomFilterKeyFields, int[] btreeFields,
-            int[] filterFields, ILSMHarness lsmHarness) {
+            ISearchOperationCallback searchCallback, int numBloomFilterKeyFields, int[] btreeFields, int[] filterFields,
+            ILSMHarness lsmHarness) {
         LSMBTreeMemoryComponent c = (LSMBTreeMemoryComponent) mutableComponents.get(0);
         IBinaryComparatorFactory cmpFactories[] = c.getBTree().getComparatorFactories();
         if (cmpFactories[0] != null) {
@@ -99,11 +105,11 @@
         this.deleteLeafFrameFactory = deleteLeafFrameFactory;
         this.insertLeafFrame = (IBTreeLeafFrame) insertLeafFrameFactory.createFrame();
         this.deleteLeafFrame = (IBTreeLeafFrame) deleteLeafFrameFactory.createFrame();
-        if (insertLeafFrame != null && this.cmp != null) {
-            insertLeafFrame.setMultiComparator(cmp);
+        if (insertLeafFrame != null && this.getCmp() != null) {
+            insertLeafFrame.setMultiComparator(getCmp());
         }
-        if (deleteLeafFrame != null && this.cmp != null) {
-            deleteLeafFrame.setMultiComparator(cmp);
+        if (deleteLeafFrame != null && this.getCmp() != null) {
+            deleteLeafFrame.setMultiComparator(getCmp());
         }
         this.componentHolder = new LinkedList<>();
         this.componentsToBeMerged = new LinkedList<>();
@@ -120,13 +126,10 @@
             filterCmp = null;
             filterTuple = null;
         }
-        searchPredicate = new RangePredicate(null, null, true, true, cmp, cmp);
-        if (insertLeafFrame != null) {
-            memCursor = new BTreeRangeSearchCursor(insertLeafFrame, false);
-        }
-
-        searchInitialState = new LSMBTreeCursorInitialState(insertLeafFrameFactory, cmp, bloomFilterCmp, lsmHarness,
-                null, searchCallback, null);
+        searchPredicate = new RangePredicate(null, null, true, true, getCmp(), getCmp());
+        memCursor = (insertLeafFrame != null) ? new BTreeRangeSearchCursor(insertLeafFrame, false) : null;
+        searchInitialState = new LSMBTreeCursorInitialState(insertLeafFrameFactory, getCmp(), bloomFilterCmp,
+                lsmHarness, null, searchCallback, null);
         insertSearchCursor = new LSMBTreePointSearchCursor(this);
     }
 
@@ -137,13 +140,13 @@
     }
 
     public void setInsertMode() {
-        currentMutableBTreeOpCtx.leafFrame = insertLeafFrame;
-        currentMutableBTreeOpCtx.leafFrameFactory = insertLeafFrameFactory;
+        currentMutableBTreeOpCtx.setLeafFrame(insertLeafFrame);
+        currentMutableBTreeOpCtx.setLeafFrameFactory(insertLeafFrameFactory);
     }
 
     public void setDeleteMode() {
-        currentMutableBTreeOpCtx.leafFrame = deleteLeafFrame;
-        currentMutableBTreeOpCtx.leafFrameFactory = deleteLeafFrameFactory;
+        currentMutableBTreeOpCtx.setLeafFrame(deleteLeafFrame);
+        currentMutableBTreeOpCtx.setLeafFrameFactory(deleteLeafFrameFactory);
     }
 
     @Override
@@ -176,18 +179,15 @@
 
     @Override
     public void setCurrentMutableComponentId(int currentMutableComponentId) {
-        currentMutableBTreeAccessor = mutableBTreeAccessors[currentMutableComponentId];
+        setCurrentMutableBTreeAccessor(mutableBTreeAccessors[currentMutableComponentId]);
         currentMutableBTreeOpCtx = mutableBTreeOpCtxs[currentMutableComponentId];
         switch (op) {
             case SEARCH:
-                break;
             case DISKORDERSCAN:
             case UPDATE:
-                // Attention: It is important to leave the leafFrame and
-                // leafFrameFactory of the mutableBTree as is when doing an update.
-                // Update will only be set if a previous attempt to delete or
-                // insert failed, so we must preserve the semantics of the
-                // previously requested operation.
+                // Attention: It is important to leave the leafFrame and leafFrameFactory of the mutableBTree as is
+                // when doing an update. Update will only be set if a previous attempt to delete or insert failed,
+                // so we must preserve the semantics of the previously requested operation.
                 break;
             case UPSERT:
             case INSERT:
@@ -219,4 +219,40 @@
     public List<ILSMDiskComponent> getComponentsToBeReplicated() {
         return componentsToBeReplicated;
     }
+
+    public MultiComparator getFilterCmp() {
+        return filterCmp;
+    }
+
+    public PermutingTupleReference getIndexTuple() {
+        return indexTuple;
+    }
+
+    public BTree.BTreeAccessor getCurrentMutableBTreeAccessor() {
+        return currentMutableBTreeAccessor;
+    }
+
+    public void setCurrentMutableBTreeAccessor(BTree.BTreeAccessor currentMutableBTreeAccessor) {
+        this.currentMutableBTreeAccessor = currentMutableBTreeAccessor;
+    }
+
+    public PermutingTupleReference getFilterTuple() {
+        return filterTuple;
+    }
+
+    public LSMBTreePointSearchCursor getInsertSearchCursor() {
+        return insertSearchCursor;
+    }
+
+    public BTreeRangeSearchCursor getMemCursor() {
+        return memCursor;
+    }
+
+    public LSMBTreeCursorInitialState getSearchInitialState() {
+        return searchInitialState;
+    }
+
+    public MultiComparator getCmp() {
+        return cmp;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
index cc2e7fb..6788cdf 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
@@ -276,7 +276,7 @@
                         if (c.getLSMComponentFilter().satisfy(
                                 ((AbstractSearchPredicate) ctx.getSearchPredicate()).getMinFilterTuple(),
                                 ((AbstractSearchPredicate) ctx.getSearchPredicate()).getMaxFilterTuple(),
-                                ((LSMInvertedIndexOpContext) ctx).filterCmp)) {
+                                ((LSMInvertedIndexOpContext) ctx).getFilterCmp())) {
                             operationalComponents.add(c);
                         }
                     }
@@ -323,9 +323,9 @@
         // what they should be for an inverted index).
 
         ITupleReference indexTuple;
-        if (ctx.indexTuple != null) {
-            ctx.indexTuple.reset(tuple);
-            indexTuple = ctx.indexTuple;
+        if (ctx.getIndexTuple() != null) {
+            ctx.getIndexTuple().reset(tuple);
+            indexTuple = ctx.getIndexTuple();
         } else {
             indexTuple = tuple;
         }
@@ -335,16 +335,16 @@
         switch (ctx.getOperation()) {
             case INSERT: {
                 // Insert into the in-memory inverted index.
-                ctx.currentMutableInvIndexAccessors.insert(indexTuple);
+                ctx.getCurrentMutableInvIndexAccessors().insert(indexTuple);
                 break;
             }
             case DELETE: {
                 // First remove all entries in the in-memory inverted index (if any).
-                ctx.currentMutableInvIndexAccessors.delete(indexTuple);
+                ctx.getCurrentMutableInvIndexAccessors().delete(indexTuple);
                 // Insert key into the deleted-keys BTree.
-                ctx.keysOnlyTuple.reset(indexTuple);
+                ctx.getKeysOnlyTuple().reset(indexTuple);
                 try {
-                    ctx.currentDeletedKeysBTreeAccessors.insert(ctx.keysOnlyTuple);
+                    ctx.getCurrentDeletedKeysBTreeAccessors().insert(ctx.getKeysOnlyTuple());
                 } catch (HyracksDataException e) {
                     if (e.getErrorCode() != ErrorCode.DUPLICATE_KEY) {
                         // Key has already been deleted.
@@ -358,10 +358,10 @@
                 throw new UnsupportedOperationException("Operation " + ctx.getOperation() + " not supported.");
             }
         }
-        if (ctx.filterTuple != null) {
-            ctx.filterTuple.reset(tuple);
-            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.filterTuple,
-                    ctx.filterCmp);
+        if (ctx.getFilterTuple() != null) {
+            ctx.getFilterTuple().reset(tuple);
+            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.getFilterTuple(),
+                    ctx.getFilterCmp());
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
index c8ff02f..daf4e68 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
@@ -31,8 +31,8 @@
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
 import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent;
 import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexAccessor;
@@ -50,21 +50,21 @@
     private ISearchOperationCallback searchCallback;
 
     // Tuple that only has the inverted-index elements (aka keys), projecting away the document fields.
-    public PermutingTupleReference keysOnlyTuple;
+    private PermutingTupleReference keysOnlyTuple;
 
     // Accessor to the in-memory inverted indexes.
-    public IInvertedIndexAccessor[] mutableInvIndexAccessors;
+    private IInvertedIndexAccessor[] mutableInvIndexAccessors;
     // Accessor to the deleted-keys BTrees.
-    public IIndexAccessor[] deletedKeysBTreeAccessors;
+    private IIndexAccessor[] deletedKeysBTreeAccessors;
 
-    public IInvertedIndexAccessor currentMutableInvIndexAccessors;
-    public IIndexAccessor currentDeletedKeysBTreeAccessors;
+    private IInvertedIndexAccessor currentMutableInvIndexAccessors;
+    private IIndexAccessor currentDeletedKeysBTreeAccessors;
 
-    public final PermutingTupleReference indexTuple;
-    public final MultiComparator filterCmp;
-    public final PermutingTupleReference filterTuple;
+    private final PermutingTupleReference indexTuple;
+    private final MultiComparator filterCmp;
+    private final PermutingTupleReference filterTuple;
 
-    public ISearchPredicate searchPredicate;
+    private ISearchPredicate searchPredicate;
 
     public LSMInvertedIndexOpContext(List<ILSMMemoryComponent> mutableComponents,
             IModificationOperationCallback modificationCallback, ISearchOperationCallback searchCallback,
@@ -169,4 +169,28 @@
     public List<ILSMDiskComponent> getComponentsToBeReplicated() {
         return componentsToBeReplicated;
     }
+
+    public MultiComparator getFilterCmp() {
+        return filterCmp;
+    }
+
+    public PermutingTupleReference getIndexTuple() {
+        return indexTuple;
+    }
+
+    public IInvertedIndexAccessor getCurrentMutableInvIndexAccessors() {
+        return currentMutableInvIndexAccessors;
+    }
+
+    public PermutingTupleReference getKeysOnlyTuple() {
+        return keysOnlyTuple;
+    }
+
+    public IIndexAccessor getCurrentDeletedKeysBTreeAccessors() {
+        return currentDeletedKeysBTreeAccessors;
+    }
+
+    public PermutingTupleReference getFilterTuple() {
+        return filterTuple;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java
index 1b33e79..e02777d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java
@@ -112,10 +112,10 @@
     public void insert(ITupleReference tuple, BTreeAccessor btreeAccessor, IIndexOperationContext ictx)
             throws HyracksDataException {
         InMemoryInvertedIndexOpContext ctx = (InMemoryInvertedIndexOpContext) ictx;
-        ctx.tupleIter.reset(tuple);
-        while (ctx.tupleIter.hasNext()) {
-            ctx.tupleIter.next();
-            ITupleReference insertTuple = ctx.tupleIter.getTuple();
+        ctx.getTupleIter().reset(tuple);
+        while (ctx.getTupleIter().hasNext()) {
+            ctx.getTupleIter().next();
+            ITupleReference insertTuple = ctx.getTupleIter().getTuple();
             try {
                 btreeAccessor.insert(insertTuple);
             } catch (HyracksDataException e) {
@@ -132,10 +132,10 @@
     public void delete(ITupleReference tuple, BTreeAccessor btreeAccessor, IIndexOperationContext ictx)
             throws HyracksDataException {
         InMemoryInvertedIndexOpContext ctx = (InMemoryInvertedIndexOpContext) ictx;
-        ctx.tupleIter.reset(tuple);
-        while (ctx.tupleIter.hasNext()) {
-            ctx.tupleIter.next();
-            ITupleReference deleteTuple = ctx.tupleIter.getTuple();
+        ctx.getTupleIter().reset(tuple);
+        while (ctx.getTupleIter().hasNext()) {
+            ctx.getTupleIter().next();
+            ITupleReference deleteTuple = ctx.getTupleIter().getTuple();
             try {
                 btreeAccessor.delete(deleteTuple);
             } catch (HyracksDataException e) {
@@ -164,7 +164,7 @@
         InMemoryInvertedIndexOpContext ctx = (InMemoryInvertedIndexOpContext) ictx;
         ctx.setOperation(IndexOperation.SEARCH);
         InMemoryInvertedListCursor inMemListCursor = (InMemoryInvertedListCursor) listCursor;
-        inMemListCursor.prepare(ctx.btreeAccessor, ctx.btreePred, ctx.tokenFieldsCmp, ctx.btreeCmp);
+        inMemListCursor.prepare(ctx.getBtreeAccessor(), ctx.getBtreePred(), ctx.getTokenFieldsCmp(), ctx.getBtreeCmp());
         inMemListCursor.reset(searchKey);
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java
index cf6dff3..1b5344f 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java
@@ -32,21 +32,22 @@
 import org.apache.hyracks.storage.am.lsm.invertedindex.util.InvertedIndexTokenizingTupleIterator;
 
 public class InMemoryInvertedIndexOpContext implements IIndexOperationContext {
-    public IndexOperation op;
-    public final BTree btree;
+    protected final BTree btree;
+    protected final IBinaryComparatorFactory[] tokenCmpFactories;
+    private IndexOperation op;
 
     // Needed for search operations,
-    public RangePredicate btreePred;
-    public BTreeAccessor btreeAccessor;
-    public MultiComparator btreeCmp;
-    public IBinaryComparatorFactory[] tokenCmpFactories;
-    public MultiComparator tokenFieldsCmp;
+    private RangePredicate btreePred;
+    private BTreeAccessor btreeAccessor;
+    private MultiComparator btreeCmp;
+
+    private MultiComparator tokenFieldsCmp;
 
     // To generate in-memory BTree tuples for insertions.
-    protected final IBinaryTokenizerFactory tokenizerFactory;
-    public InvertedIndexTokenizingTupleIterator tupleIter;
+    private final IBinaryTokenizerFactory tokenizerFactory;
+    private InvertedIndexTokenizingTupleIterator tupleIter;
 
-    public InMemoryInvertedIndexOpContext(BTree btree, IBinaryComparatorFactory[] tokenCmpFactories,
+    InMemoryInvertedIndexOpContext(BTree btree, IBinaryComparatorFactory[] tokenCmpFactories,
             IBinaryTokenizerFactory tokenizerFactory) {
         this.btree = btree;
         this.tokenCmpFactories = tokenCmpFactories;
@@ -58,13 +59,13 @@
         switch (newOp) {
             case INSERT:
             case DELETE: {
-                if (tupleIter == null) {
+                if (getTupleIter() == null) {
                     setTokenizingTupleIterator();
                 }
                 break;
             }
             case SEARCH: {
-                if (btreePred == null) {
+                if (getBtreePred() == null) {
                     btreePred = new RangePredicate(null, null, true, true, null, null);
                     btreeAccessor = (BTreeAccessor) btree.createAccessor(NoOpOperationCallback.INSTANCE,
                             NoOpOperationCallback.INSTANCE);
@@ -91,8 +92,36 @@
     }
 
     protected void setTokenizingTupleIterator() {
-        IBinaryTokenizer tokenizer = tokenizerFactory.createTokenizer();
-        tupleIter = new InvertedIndexTokenizingTupleIterator(tokenCmpFactories.length, btree.getFieldCount()
-                - tokenCmpFactories.length, tokenizer);
+        IBinaryTokenizer tokenizer = getTokenizerFactory().createTokenizer();
+        tupleIter = new InvertedIndexTokenizingTupleIterator(tokenCmpFactories.length,
+                btree.getFieldCount() - tokenCmpFactories.length, tokenizer);
+    }
+
+    public InvertedIndexTokenizingTupleIterator getTupleIter() {
+        return tupleIter;
+    }
+
+    public BTreeAccessor getBtreeAccessor() {
+        return btreeAccessor;
+    }
+
+    public RangePredicate getBtreePred() {
+        return btreePred;
+    }
+
+    public MultiComparator getTokenFieldsCmp() {
+        return tokenFieldsCmp;
+    }
+
+    public MultiComparator getBtreeCmp() {
+        return btreeCmp;
+    }
+
+    public IBinaryTokenizerFactory getTokenizerFactory() {
+        return tokenizerFactory;
+    }
+
+    public void setTupleIter(InvertedIndexTokenizingTupleIterator tupleIter) {
+        this.tupleIter = tupleIter;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java
index 24d1cdd..502891c 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndex.java
@@ -62,7 +62,7 @@
         super.insert(tuple, btreeAccessor, ictx);
         PartitionedInMemoryInvertedIndexOpContext ctx = (PartitionedInMemoryInvertedIndexOpContext) ictx;
         PartitionedInvertedIndexTokenizingTupleIterator tupleIter =
-                (PartitionedInvertedIndexTokenizingTupleIterator) ctx.tupleIter;
+                (PartitionedInvertedIndexTokenizingTupleIterator) ctx.getTupleIter();
         updatePartitionIndexes(tupleIter.getNumTokens());
     }
 
@@ -123,8 +123,8 @@
         ctx.setOperation(IndexOperation.SEARCH);
         // We can pick either of the full low or high search key, since they should be identical here.
         ITupleReference searchKey = partSearcher.getFullLowSearchKey();
-        ctx.btreePred.setLowKey(searchKey, true);
-        ctx.btreePred.setHighKey(searchKey, true);
+        ctx.getBtreePred().setLowKey(searchKey, true);
+        ctx.getBtreePred().setHighKey(searchKey, true);
         // Go through all possibly partitions and see if the token matches.
         // TODO: This procedure could be made more efficient by determining the next partition to search
         // using the last existing partition and re-searching the BTree with an open interval as low key.
@@ -132,7 +132,8 @@
             partSearcher.setNumTokensBoundsInSearchKeys(i, i);
             InMemoryInvertedListCursor inMemListCursor =
                     (InMemoryInvertedListCursor) partSearcher.getCachedInvertedListCursor();
-            inMemListCursor.prepare(ctx.btreeAccessor, ctx.btreePred, ctx.tokenFieldsCmp, ctx.btreeCmp);
+            inMemListCursor.prepare(ctx.getBtreeAccessor(), ctx.getBtreePred(), ctx.getTokenFieldsCmp(),
+                    ctx.getBtreeCmp());
             inMemListCursor.reset(searchKey);
             invListPartitions.addInvertedListCursor(inMemListCursor, i);
         }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexOpContext.java
index 742af79..bd82822 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/PartitionedInMemoryInvertedIndexOpContext.java
@@ -33,8 +33,8 @@
     }
 
     protected void setTokenizingTupleIterator() {
-        IBinaryTokenizer tokenizer = tokenizerFactory.createTokenizer();
-        tupleIter = new PartitionedInvertedIndexTokenizingTupleIterator(tokenCmpFactories.length, btree.getFieldCount()
-                - tokenCmpFactories.length, tokenizer);
+        IBinaryTokenizer tokenizer = getTokenizerFactory().createTokenizer();
+        setTupleIter(new PartitionedInvertedIndexTokenizingTupleIterator(tokenCmpFactories.length, btree.getFieldCount()
+                - tokenCmpFactories.length, tokenizer));
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java
index 1dcd18e..6547819 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java
@@ -256,21 +256,21 @@
     public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey,
             IIndexOperationContext ictx) throws HyracksDataException {
         OnDiskInvertedIndexOpContext ctx = (OnDiskInvertedIndexOpContext) ictx;
-        ctx.btreePred.setLowKeyComparator(ctx.searchCmp);
-        ctx.btreePred.setHighKeyComparator(ctx.searchCmp);
-        ctx.btreePred.setLowKey(searchKey, true);
-        ctx.btreePred.setHighKey(searchKey, true);
-        ctx.btreeAccessor.search(ctx.btreeCursor, ctx.btreePred);
+        ctx.getBtreePred().setLowKeyComparator(ctx.getSearchCmp());
+        ctx.getBtreePred().setHighKeyComparator(ctx.getSearchCmp());
+        ctx.getBtreePred().setLowKey(searchKey, true);
+        ctx.getBtreePred().setHighKey(searchKey, true);
+        ctx.getBtreeAccessor().search(ctx.getBtreeCursor(), ctx.getBtreePred());
         try {
-            if (ctx.btreeCursor.hasNext()) {
-                ctx.btreeCursor.next();
-                resetInvertedListCursor(ctx.btreeCursor.getTuple(), listCursor);
+            if (ctx.getBtreeCursor().hasNext()) {
+                ctx.getBtreeCursor().next();
+                resetInvertedListCursor(ctx.getBtreeCursor().getTuple(), listCursor);
             } else {
                 listCursor.reset(0, 0, 0, 0);
             }
         } finally {
-            ctx.btreeCursor.close();
-            ctx.btreeCursor.reset();
+            ctx.getBtreeCursor().close();
+            ctx.getBtreeCursor().reset();
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java
index b75f0eb..828c6a8 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java
@@ -30,12 +30,12 @@
 
 public class OnDiskInvertedIndexOpContext implements IIndexOperationContext {
 
-    public final RangePredicate btreePred = new RangePredicate(null, null, true, true, null, null);
-    public IIndexAccessor btreeAccessor;
-    public IIndexCursor btreeCursor;
-    public MultiComparator searchCmp;
+    private final RangePredicate btreePred = new RangePredicate(null, null, true, true, null, null);
+    private IIndexAccessor btreeAccessor;
+    private IIndexCursor btreeCursor;
+    private MultiComparator searchCmp;
     // For prefix search on partitioned indexes.
-    public MultiComparator prefixSearchCmp;
+    private MultiComparator prefixSearchCmp;
 
     public OnDiskInvertedIndexOpContext(BTree btree) {
         // TODO: Ignore opcallbacks for now.
@@ -61,4 +61,24 @@
     public IndexOperation getOperation() {
         return IndexOperation.SEARCH;
     }
+
+    public RangePredicate getBtreePred() {
+        return btreePred;
+    }
+
+    public MultiComparator getSearchCmp() {
+        return searchCmp;
+    }
+
+    public IIndexAccessor getBtreeAccessor() {
+        return btreeAccessor;
+    }
+
+    public IIndexCursor getBtreeCursor() {
+        return btreeCursor;
+    }
+
+    public MultiComparator getPrefixSearchCmp() {
+        return prefixSearchCmp;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndex.java
index 697d217..6af601f 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndex.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndex.java
@@ -76,27 +76,27 @@
         ITupleReference highSearchKey = null;
         partSearcher.setNumTokensBoundsInSearchKeys(numTokensLowerBound, numTokensUpperBound);
         if (numTokensLowerBound < 0) {
-            ctx.btreePred.setLowKeyComparator(ctx.prefixSearchCmp);
+            ctx.getBtreePred().setLowKeyComparator(ctx.getPrefixSearchCmp());
             lowSearchKey = partSearcher.getPrefixSearchKey();
         } else {
-            ctx.btreePred.setLowKeyComparator(ctx.searchCmp);
+            ctx.getBtreePred().setLowKeyComparator(ctx.getSearchCmp());
             lowSearchKey = partSearcher.getFullLowSearchKey();
         }
         if (numTokensUpperBound < 0) {
-            ctx.btreePred.setHighKeyComparator(ctx.prefixSearchCmp);
+            ctx.getBtreePred().setHighKeyComparator(ctx.getPrefixSearchCmp());
             highSearchKey = partSearcher.getPrefixSearchKey();
         } else {
-            ctx.btreePred.setHighKeyComparator(ctx.searchCmp);
+            ctx.getBtreePred().setHighKeyComparator(ctx.getSearchCmp());
             highSearchKey = partSearcher.getFullHighSearchKey();
         }
-        ctx.btreePred.setLowKey(lowSearchKey, true);
-        ctx.btreePred.setHighKey(highSearchKey, true);
-        ctx.btreeAccessor.search(ctx.btreeCursor, ctx.btreePred);
+        ctx.getBtreePred().setLowKey(lowSearchKey, true);
+        ctx.getBtreePred().setHighKey(highSearchKey, true);
+        ctx.getBtreeAccessor().search(ctx.getBtreeCursor(), ctx.getBtreePred());
         boolean tokenExists = false;
         try {
-            while (ctx.btreeCursor.hasNext()) {
-                ctx.btreeCursor.next();
-                ITupleReference btreeTuple = ctx.btreeCursor.getTuple();
+            while (ctx.getBtreeCursor().hasNext()) {
+                ctx.getBtreeCursor().next();
+                ITupleReference btreeTuple = ctx.getBtreeCursor().getTuple();
                 short numTokens = ShortPointable.getShort(btreeTuple.getFieldData(PARTITIONING_NUM_TOKENS_FIELD),
                         btreeTuple.getFieldStart(PARTITIONING_NUM_TOKENS_FIELD));
                 IInvertedListCursor invListCursor = partSearcher.getCachedInvertedListCursor();
@@ -106,8 +106,8 @@
                 tokenExists = true;
             }
         } finally {
-            ctx.btreeCursor.close();
-            ctx.btreeCursor.reset();
+            ctx.getBtreeCursor().close();
+            ctx.getBtreeCursor().reset();
         }
         return tokenExists;
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
index 646dbef..14db8e7 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
@@ -232,7 +232,7 @@
                         if (c.getLSMComponentFilter().satisfy(
                                 ((AbstractSearchPredicate) ctx.getSearchPredicate()).getMinFilterTuple(),
                                 ((AbstractSearchPredicate) ctx.getSearchPredicate()).getMaxFilterTuple(),
-                                ((LSMRTreeOpContext) ctx).filterCmp)) {
+                                ((LSMRTreeOpContext) ctx).getFilterCmp())) {
                             operationalComponents.add(c);
                         }
                     }
@@ -258,7 +258,7 @@
     public void search(ILSMIndexOperationContext ictx, IIndexCursor cursor, ISearchPredicate pred)
             throws HyracksDataException {
         LSMRTreeOpContext ctx = (LSMRTreeOpContext) ictx;
-        cursor.open(ctx.searchInitialState, pred);
+        cursor.open(ctx.getSearchInitialState(), pred);
     }
 
     protected LSMComponentFileReferences getMergeTargetFileName(List<ILSMComponent> mergingDiskComponents)
@@ -348,9 +348,9 @@
         }
 
         ITupleReference indexTuple;
-        if (ctx.indexTuple != null) {
-            ctx.indexTuple.reset(tuple);
-            indexTuple = ctx.indexTuple;
+        if (ctx.getIndexTuple() != null) {
+            ctx.getIndexTuple().reset(tuple);
+            indexTuple = ctx.getIndexTuple();
         } else {
             indexTuple = tuple;
         }
@@ -358,13 +358,13 @@
         ctx.getModificationCallback().before(indexTuple);
         ctx.getModificationCallback().found(null, indexTuple);
         if (ctx.getOperation() == IndexOperation.INSERT) {
-            ctx.currentMutableRTreeAccessor.insert(indexTuple);
+            ctx.getCurrentMutableRTreeAccessor().insert(indexTuple);
         } else {
             // First remove all entries in the in-memory rtree (if any).
-            ctx.currentMutableRTreeAccessor.delete(indexTuple);
+            ctx.getCurrentMutableRTreeAccessor().delete(indexTuple);
             // Insert key into the deleted-keys BTree.
             try {
-                ctx.currentMutableBTreeAccessor.insert(indexTuple);
+                ctx.getCurrentMutableBTreeAccessor().insert(indexTuple);
             } catch (HyracksDataException e) {
                 if (e.getErrorCode() != ErrorCode.DUPLICATE_KEY) {
                     // Do nothing, because one delete tuple is enough to indicate
@@ -373,10 +373,10 @@
                 }
             }
         }
-        if (ctx.filterTuple != null) {
-            ctx.filterTuple.reset(tuple);
-            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.filterTuple,
-                    ctx.filterCmp);
+        if (ctx.getFilterTuple() != null) {
+            ctx.getFilterTuple().reset(tuple);
+            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.getFilterTuple(),
+                    ctx.getFilterCmp());
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTree.java
index dce7102..2452de7 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTree.java
@@ -248,9 +248,8 @@
             throws HyracksDataException {
         ExternalRTreeOpContext ctx = (ExternalRTreeOpContext) ictx;
         List<ILSMComponent> operationalComponents = ictx.getComponentHolder();
-        ctx.initialState.setOperationalComponents(operationalComponents);
-
-        cursor.open(ctx.initialState, pred);
+        ctx.getInitialState().setOperationalComponents(operationalComponents);
+        cursor.open(ctx.getInitialState(), pred);
     }
 
     // The only reason for overriding the merge method is the way to determine
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTreeOpContext.java
index dcd2c67..deff255 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/ExternalRTreeOpContext.java
@@ -28,8 +28,8 @@
 import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext;
 
@@ -37,13 +37,13 @@
     private IndexOperation op;
     private MultiComparator bTreeCmp;
     private MultiComparator rTreeCmp;
-    public final List<ILSMComponent> componentHolder;
+    private final List<ILSMComponent> componentHolder;
     private final List<ILSMDiskComponent> componentsToBeMerged;
     private final List<ILSMDiskComponent> componentsToBeReplicated;
-    public final ISearchOperationCallback searchCallback;
+    private final ISearchOperationCallback searchCallback;
     private final int targetIndexVersion;
-    public ISearchPredicate searchPredicate;
-    public LSMRTreeCursorInitialState initialState;
+    private ISearchPredicate searchPredicate;
+    private LSMRTreeCursorInitialState initialState;
 
     public ExternalRTreeOpContext(IBinaryComparatorFactory[] rtreeCmpFactories,
             IBinaryComparatorFactory[] btreeCmpFactories, ISearchOperationCallback searchCallback,
@@ -133,4 +133,8 @@
     public List<ILSMDiskComponent> getComponentsToBeReplicated() {
         return componentsToBeReplicated;
     }
+
+    public LSMRTreeCursorInitialState getInitialState() {
+        return initialState;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java
index 497a887..fd3f64b 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java
@@ -454,7 +454,7 @@
 
         public MultiComparator getMultiComparator() {
             LSMRTreeOpContext concreteCtx = (LSMRTreeOpContext) ctx;
-            return concreteCtx.currentRTreeOpContext.cmp;
+            return concreteCtx.getCurrentRTreeOpContext().getCmp();
         }
     }
 
@@ -479,9 +479,9 @@
         }
 
         ITupleReference indexTuple;
-        if (ctx.indexTuple != null) {
-            ctx.indexTuple.reset(tuple);
-            indexTuple = ctx.indexTuple;
+        if (ctx.getIndexTuple() != null) {
+            ctx.getIndexTuple().reset(tuple);
+            indexTuple = ctx.getIndexTuple();
         } else {
             indexTuple = tuple;
         }
@@ -489,12 +489,12 @@
         ctx.getModificationCallback().before(indexTuple);
         ctx.getModificationCallback().found(null, indexTuple);
         if (ctx.getOperation() == IndexOperation.INSERT) {
-            ctx.currentMutableRTreeAccessor.insert(indexTuple);
+            ctx.getCurrentMutableRTreeAccessor().insert(indexTuple);
         } else {
             // First remove all entries in the in-memory rtree (if any).
-            ctx.currentMutableRTreeAccessor.delete(indexTuple);
+            ctx.getCurrentMutableRTreeAccessor().delete(indexTuple);
             try {
-                ctx.currentMutableBTreeAccessor.insert(((DualTupleReference) tuple).getPermutingTuple());
+                ctx.getCurrentMutableBTreeAccessor().insert(((DualTupleReference) tuple).getPermutingTuple());
             } catch (HyracksDataException e) {
                 // Do nothing, because one delete tuple is enough to indicate
                 // that all the corresponding insert tuples are deleted
@@ -503,10 +503,10 @@
                 }
             }
         }
-        if (ctx.filterTuple != null) {
-            ctx.filterTuple.reset(tuple);
-            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.filterTuple,
-                    ctx.filterCmp);
+        if (ctx.getFilterTuple() != null) {
+            ctx.getFilterTuple().reset(tuple);
+            memoryComponents.get(currentMutableComponentId.get()).getLSMComponentFilter().update(ctx.getFilterTuple(),
+                    ctx.getFilterCmp());
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
index 433d99d..0b1fd6c 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
@@ -33,8 +33,8 @@
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
 import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMHarness;
 import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent;
 import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndexOperationContext;
@@ -43,27 +43,27 @@
 
 public final class LSMRTreeOpContext extends AbstractLSMIndexOperationContext {
 
-    public RTree.RTreeAccessor[] mutableRTreeAccessors;
-    public RTree.RTreeAccessor currentMutableRTreeAccessor;
-    public BTree.BTreeAccessor[] mutableBTreeAccessors;
-    public BTree.BTreeAccessor currentMutableBTreeAccessor;
+    private RTree.RTreeAccessor[] mutableRTreeAccessors;
+    private RTree.RTreeAccessor currentMutableRTreeAccessor;
+    private BTree.BTreeAccessor[] mutableBTreeAccessors;
+    private BTree.BTreeAccessor currentMutableBTreeAccessor;
 
-    public RTreeOpContext[] rtreeOpContexts;
-    public BTreeOpContext[] btreeOpContexts;
-    public RTreeOpContext currentRTreeOpContext;
-    public BTreeOpContext currentBTreeOpContext;
+    private RTreeOpContext[] rtreeOpContexts;
+    private BTreeOpContext[] btreeOpContexts;
+    private RTreeOpContext currentRTreeOpContext;
+    private BTreeOpContext currentBTreeOpContext;
 
     private IndexOperation op;
-    public final List<ILSMComponent> componentHolder;
+    private final List<ILSMComponent> componentHolder;
     private final List<ILSMDiskComponent> componentsToBeMerged;
     private final List<ILSMDiskComponent> componentsToBeReplicated;
     private IModificationOperationCallback modificationCallback;
     private ISearchOperationCallback searchCallback;
-    public final PermutingTupleReference indexTuple;
-    public final MultiComparator filterCmp;
-    public final PermutingTupleReference filterTuple;
-    public ISearchPredicate searchPredicate;
-    public LSMRTreeCursorInitialState searchInitialState;
+    private final PermutingTupleReference indexTuple;
+    private final MultiComparator filterCmp;
+    private final PermutingTupleReference filterTuple;
+    private ISearchPredicate searchPredicate;
+    private LSMRTreeCursorInitialState searchInitialState;
 
     public LSMRTreeOpContext(List<ILSMMemoryComponent> mutableComponents, ITreeIndexFrameFactory rtreeLeafFrameFactory,
             ITreeIndexFrameFactory rtreeInteriorFrameFactory, ITreeIndexFrameFactory btreeLeafFrameFactory,
@@ -143,7 +143,7 @@
     }
 
     public MultiComparator getBTreeMultiComparator() {
-        return currentBTreeOpContext.cmp;
+        return currentBTreeOpContext.getCmp();
     }
 
     @Override
@@ -180,4 +180,32 @@
     public List<ILSMDiskComponent> getComponentsToBeReplicated() {
         return componentsToBeReplicated;
     }
+
+    public MultiComparator getFilterCmp() {
+        return filterCmp;
+    }
+
+    public LSMRTreeCursorInitialState getSearchInitialState() {
+        return searchInitialState;
+    }
+
+    public PermutingTupleReference getIndexTuple() {
+        return indexTuple;
+    }
+
+    public RTree.RTreeAccessor getCurrentMutableRTreeAccessor() {
+        return currentMutableRTreeAccessor;
+    }
+
+    public BTree.BTreeAccessor getCurrentMutableBTreeAccessor() {
+        return currentMutableBTreeAccessor;
+    }
+
+    public PermutingTupleReference getFilterTuple() {
+        return filterTuple;
+    }
+
+    public RTreeOpContext getCurrentRTreeOpContext() {
+        return currentRTreeOpContext;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java
index b246e8f..242e62e 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java
@@ -331,7 +331,7 @@
 
         public MultiComparator getMultiComparator() {
             LSMRTreeOpContext concreteCtx = (LSMRTreeOpContext) ctx;
-            return concreteCtx.currentRTreeOpContext.cmp;
+            return concreteCtx.getCurrentRTreeOpContext().getCmp();
         }
     }
 
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java
index 7b2ed48..00c67fa 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java
@@ -172,13 +172,13 @@
             while (true) {
                 if (!writeLatched) {
                     node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-                    ctx.interiorFrame.setPage(node);
-                    isLeaf = ctx.interiorFrame.isLeaf();
+                    ctx.getInteriorFrame().setPage(node);
+                    isLeaf = ctx.getInteriorFrame().isLeaf();
                     if (isLeaf) {
                         node.acquireWriteLatch();
                         writeLatched = true;
 
-                        if (!ctx.interiorFrame.isLeaf()) {
+                        if (!ctx.getInteriorFrame().isLeaf()) {
                             node.releaseWriteLatch(true);
                             writeLatched = false;
                             bufferCache.unpin(node);
@@ -193,7 +193,7 @@
                     }
                 }
 
-                if (pageId != rootPage && parentLsn < ctx.interiorFrame.getPageNsn()) {
+                if (pageId != rootPage && parentLsn < ctx.getInteriorFrame().getPageNsn()) {
                     // Concurrent split detected, go back to parent and
                     // re-choose the best child
                     if (writeLatched) {
@@ -206,21 +206,22 @@
                         bufferCache.unpin(node);
                     }
 
-                    pageId = ctx.pathList.getLastPageId();
+                    pageId = ctx.getPathList().getLastPageId();
                     if (pageId != rootPage) {
-                        parentLsn = ctx.pathList.getPageLsn(ctx.pathList.size() - 2);
+                        parentLsn = ctx.getPathList().getPageLsn(ctx.getPathList().size() - 2);
                     }
-                    ctx.pathList.moveLast();
+                    ctx.getPathList().moveLast();
                     continue;
                 }
 
-                pageLsn = ctx.interiorFrame.getPageLsn();
-                ctx.pathList.add(pageId, pageLsn, -1);
+                pageLsn = ctx.getInteriorFrame().getPageLsn();
+                ctx.getPathList().add(pageId, pageLsn, -1);
 
                 if (!isLeaf) {
                     // findBestChild must be called *before* checkIfEnlarementIsNeeded
-                    int childPageId = ctx.interiorFrame.findBestChild(ctx.getTuple(), ctx.cmp);
-                    boolean enlarementIsNeeded = ctx.interiorFrame.checkIfEnlarementIsNeeded(ctx.getTuple(), ctx.cmp);
+                    int childPageId = ctx.getInteriorFrame().findBestChild(ctx.getTuple(), ctx.getCmp());
+                    boolean enlarementIsNeeded =
+                            ctx.getInteriorFrame().checkIfEnlarementIsNeeded(ctx.getTuple(), ctx.getCmp());
 
                     if (enlarementIsNeeded) {
                         if (!writeLatched) {
@@ -231,19 +232,19 @@
                             node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
                             node.acquireWriteLatch();
                             writeLatched = true;
-                            ctx.interiorFrame.setPage(node);
+                            ctx.getInteriorFrame().setPage(node);
 
-                            if (ctx.interiorFrame.getPageLsn() != pageLsn) {
+                            if (ctx.getInteriorFrame().getPageLsn() != pageLsn) {
                                 // The page was changed while we unlocked it;
                                 // thus, retry (re-choose best child)
 
-                                ctx.pathList.moveLast();
+                                ctx.getPathList().moveLast();
                                 continue;
                             }
                         }
                         // We don't need to reset the frameTuple because it is
                         // already pointing to the best child
-                        ctx.interiorFrame.enlarge(ctx.getTuple(), ctx.cmp);
+                        ctx.getInteriorFrame().enlarge(ctx.getTuple(), ctx.getCmp());
 
                         node.releaseWriteLatch(true);
                         writeLatched = false;
@@ -263,7 +264,7 @@
                     pageId = childPageId;
                     parentLsn = pageLsn;
                 } else {
-                    ctx.leafFrame.setPage(node);
+                    ctx.getLeafFrame().setPage(node);
                     succeeded = true;
                     return node;
                 }
@@ -288,25 +289,25 @@
         boolean succeeded = false;
         FrameOpSpaceStatus spaceStatus;
         if (!isLeaf) {
-            spaceStatus = ctx.interiorFrame.hasSpaceInsert(tuple);
+            spaceStatus = ctx.getInteriorFrame().hasSpaceInsert(tuple);
         } else {
-            spaceStatus = ctx.leafFrame.hasSpaceInsert(tuple);
+            spaceStatus = ctx.getLeafFrame().hasSpaceInsert(tuple);
         }
 
         switch (spaceStatus) {
             case SUFFICIENT_CONTIGUOUS_SPACE: {
                 try {
                     if (!isLeaf) {
-                        ctx.interiorFrame.insert(tuple, -1);
+                        ctx.getInteriorFrame().insert(tuple, -1);
                     } else {
-                        ctx.modificationCallback.found(null, tuple);
-                        ctx.leafFrame.insert(tuple, -1);
+                        ctx.getModificationCallback().found(null, tuple);
+                        ctx.getLeafFrame().insert(tuple, -1);
                     }
                     succeeded = true;
                 } finally {
                     if (succeeded) {
-                        ctx.LSNUpdates.add(node);
-                        ctx.splitKey.reset();
+                        ctx.getLSNUpdates().add(node);
+                        ctx.getSplitKey().reset();
                     } else if (isLeaf) {
                         // In case of a crash, we un-latch the interior node
                         // inside updateParentForInsert.
@@ -320,18 +321,18 @@
             case SUFFICIENT_SPACE: {
                 try {
                     if (!isLeaf) {
-                        ctx.interiorFrame.compact();
-                        ctx.interiorFrame.insert(tuple, -1);
+                        ctx.getInteriorFrame().compact();
+                        ctx.getInteriorFrame().insert(tuple, -1);
                     } else {
-                        ctx.leafFrame.compact();
-                        ctx.modificationCallback.found(null, tuple);
-                        ctx.leafFrame.insert(tuple, -1);
+                        ctx.getLeafFrame().compact();
+                        ctx.getModificationCallback().found(null, tuple);
+                        ctx.getLeafFrame().insert(tuple, -1);
                     }
                     succeeded = true;
                 } finally {
                     if (succeeded) {
-                        ctx.LSNUpdates.add(node);
-                        ctx.splitKey.reset();
+                        ctx.getLSNUpdates().add(node);
+                        ctx.getSplitKey().reset();
                     } else if (isLeaf) {
                         // In case of a crash, we un-latch the interior node
                         // inside updateParentForInsert.
@@ -343,7 +344,7 @@
             }
 
             case INSUFFICIENT_SPACE: {
-                int rightPageId = freePageManager.takePage(ctx.metaFrame);
+                int rightPageId = freePageManager.takePage(ctx.getMetaFrame());
                 ICachedPage rightNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, rightPageId), true);
                 rightNode.acquireWriteLatch();
 
@@ -352,26 +353,26 @@
                     if (!isLeaf) {
                         rightFrame = (IRTreeFrame) interiorFrameFactory.createFrame();
                         rightFrame.setPage(rightNode);
-                        rightFrame.initBuffer(ctx.interiorFrame.getLevel());
-                        rightFrame.setRightPage(ctx.interiorFrame.getRightPage());
-                        ctx.interiorFrame.split(rightFrame, tuple, ctx.splitKey, ctx, bufferCache);
-                        ctx.interiorFrame.setRightPage(rightPageId);
+                        rightFrame.initBuffer(ctx.getInteriorFrame().getLevel());
+                        rightFrame.setRightPage(ctx.getInteriorFrame().getRightPage());
+                        ctx.getInteriorFrame().split(rightFrame, tuple, ctx.getSplitKey(), ctx, bufferCache);
+                        ctx.getInteriorFrame().setRightPage(rightPageId);
                     } else {
                         rightFrame = (IRTreeFrame) leafFrameFactory.createFrame();
                         rightFrame.setPage(rightNode);
                         rightFrame.initBuffer((byte) 0);
-                        rightFrame.setRightPage(ctx.interiorFrame.getRightPage());
-                        ctx.modificationCallback.found(null, tuple);
-                        ctx.leafFrame.split(rightFrame, tuple, ctx.splitKey, ctx, bufferCache);
-                        ctx.leafFrame.setRightPage(rightPageId);
+                        rightFrame.setRightPage(ctx.getInteriorFrame().getRightPage());
+                        ctx.getModificationCallback().found(null, tuple);
+                        ctx.getLeafFrame().split(rightFrame, tuple, ctx.getSplitKey(), ctx, bufferCache);
+                        ctx.getLeafFrame().setRightPage(rightPageId);
                     }
                     succeeded = true;
                 } finally {
                     if (succeeded) {
-                        ctx.NSNUpdates.add(rightNode);
-                        ctx.LSNUpdates.add(rightNode);
-                        ctx.NSNUpdates.add(node);
-                        ctx.LSNUpdates.add(node);
+                        ctx.getNSNUpdates().add(rightNode);
+                        ctx.getLSNUpdates().add(rightNode);
+                        ctx.getNSNUpdates().add(node);
+                        ctx.getLSNUpdates().add(node);
                     } else if (isLeaf) {
                         // In case of a crash, we un-latch the interior node
                         // inside updateParentForInsert.
@@ -385,9 +386,9 @@
                     }
 
                 }
-                ctx.splitKey.setPages(pageId, rightPageId);
+                ctx.getSplitKey().setPages(pageId, rightPageId);
                 if (pageId == rootPage) {
-                    int newLeftId = freePageManager.takePage(ctx.metaFrame);
+                    int newLeftId = freePageManager.takePage(ctx.getMetaFrame());
                     ICachedPage newLeftNode =
                             bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, newLeftId), true);
                     newLeftNode.acquireWriteLatch();
@@ -398,25 +399,25 @@
                                 newLeftNode.getBuffer().capacity());
 
                         // initialize new root (leftNode becomes new root)
-                        ctx.interiorFrame.setPage(node);
-                        ctx.interiorFrame.initBuffer((byte) (ctx.interiorFrame.getLevel() + 1));
+                        ctx.getInteriorFrame().setPage(node);
+                        ctx.getInteriorFrame().initBuffer((byte) (ctx.getInteriorFrame().getLevel() + 1));
 
-                        ctx.splitKey.setLeftPage(newLeftId);
-                        ctx.interiorFrame.insert(ctx.splitKey.getLeftTuple(), -1);
-                        ctx.interiorFrame.insert(ctx.splitKey.getRightTuple(), -1);
+                        ctx.getSplitKey().setLeftPage(newLeftId);
+                        ctx.getInteriorFrame().insert(ctx.getSplitKey().getLeftTuple(), -1);
+                        ctx.getInteriorFrame().insert(ctx.getSplitKey().getRightTuple(), -1);
 
                         succeeded = true;
                     } finally {
                         if (succeeded) {
-                            ctx.NSNUpdates.remove(ctx.NSNUpdates.size() - 1);
-                            ctx.LSNUpdates.remove(ctx.LSNUpdates.size() - 1);
+                            ctx.getNSNUpdates().remove(ctx.getNSNUpdates().size() - 1);
+                            ctx.getLSNUpdates().remove(ctx.getLSNUpdates().size() - 1);
 
-                            ctx.NSNUpdates.add(newLeftNode);
-                            ctx.LSNUpdates.add(newLeftNode);
+                            ctx.getNSNUpdates().add(newLeftNode);
+                            ctx.getLSNUpdates().add(newLeftNode);
 
-                            ctx.NSNUpdates.add(node);
-                            ctx.LSNUpdates.add(node);
-                            ctx.splitKey.reset();
+                            ctx.getNSNUpdates().add(node);
+                            ctx.getLSNUpdates().add(node);
+                            ctx.getSplitKey().reset();
                         } else if (isLeaf) {
                             // In case of a crash, we un-latch the interior node
                             // inside updateParentForInsert.
@@ -446,23 +447,24 @@
     private void updateParentForInsert(RTreeOpContext ctx) throws HyracksDataException {
         boolean succeeded = false;
         boolean writeLatched = false;
-        int parentId = ctx.pathList.getLastPageId();
+        int parentId = ctx.getPathList().getLastPageId();
         ICachedPage parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
         parentNode.acquireWriteLatch();
         writeLatched = true;
-        ctx.interiorFrame.setPage(parentNode);
+        ctx.getInteriorFrame().setPage(parentNode);
         boolean foundParent = true;
 
         try {
-            if (ctx.interiorFrame.getPageLsn() != ctx.pathList.getLastPageLsn()) {
+            if (ctx.getInteriorFrame().getPageLsn() != ctx.getPathList().getLastPageLsn()) {
                 foundParent = false;
                 while (true) {
-                    if (ctx.interiorFrame.findTupleByPointer(ctx.splitKey.getLeftTuple(), ctx.cmp) != -1) {
+                    if (ctx.getInteriorFrame().findTupleByPointer(ctx.getSplitKey().getLeftTuple(),
+                            ctx.getCmp()) != -1) {
                         // found the parent
                         foundParent = true;
                         break;
                     }
-                    int rightPage = ctx.interiorFrame.getRightPage();
+                    int rightPage = ctx.getInteriorFrame().getRightPage();
                     parentNode.releaseWriteLatch(true);
                     writeLatched = false;
                     bufferCache.unpin(parentNode);
@@ -475,13 +477,13 @@
                     parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
                     parentNode.acquireWriteLatch();
                     writeLatched = true;
-                    ctx.interiorFrame.setPage(parentNode);
+                    ctx.getInteriorFrame().setPage(parentNode);
                 }
             }
 
             if (foundParent) {
                 try {
-                    ctx.interiorFrame.adjustKey(ctx.splitKey.getLeftTuple(), -1, ctx.cmp);
+                    ctx.getInteriorFrame().adjustKey(ctx.getSplitKey().getLeftTuple(), -1, ctx.getCmp());
                 } catch (Exception e) {
                     if (writeLatched) {
                         parentNode.releaseWriteLatch(true);
@@ -490,8 +492,9 @@
                     }
                     throw e;
                 }
-                insertTuple(parentNode, parentId, ctx.splitKey.getRightTuple(), ctx, ctx.interiorFrame.isLeaf());
-                ctx.pathList.moveLast();
+                insertTuple(parentNode, parentId, ctx.getSplitKey().getRightTuple(), ctx,
+                        ctx.getInteriorFrame().isLeaf());
+                ctx.getPathList().moveLast();
                 succeeded = true;
                 return;
 
@@ -506,7 +509,7 @@
             }
         }
 
-        ctx.traverseList.clear();
+        ctx.getTraverseList().clear();
         findPath(ctx);
         updateParentForInsert(ctx);
     }
@@ -519,39 +522,39 @@
         long pageLsn;
         int pageIndex;
         ICachedPage node = null;
-        ctx.traverseList.add(pageId, -1, parentIndex);
+        ctx.getTraverseList().add(pageId, -1, parentIndex);
         try {
-            while (!ctx.traverseList.isLast()) {
-                pageId = ctx.traverseList.getFirstPageId();
-                parentIndex = ctx.traverseList.getFirstPageIndex();
+            while (!ctx.getTraverseList().isLast()) {
+                pageId = ctx.getTraverseList().getFirstPageId();
+                parentIndex = ctx.getTraverseList().getFirstPageIndex();
 
                 node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
                 node.acquireReadLatch();
                 readLatched = true;
-                ctx.interiorFrame.setPage(node);
-                pageLsn = ctx.interiorFrame.getPageLsn();
-                pageIndex = ctx.traverseList.first();
-                ctx.traverseList.setPageLsn(pageIndex, pageLsn);
+                ctx.getInteriorFrame().setPage(node);
+                pageLsn = ctx.getInteriorFrame().getPageLsn();
+                pageIndex = ctx.getTraverseList().first();
+                ctx.getTraverseList().setPageLsn(pageIndex, pageLsn);
 
-                ctx.traverseList.moveFirst();
+                ctx.getTraverseList().moveFirst();
 
-                if (ctx.interiorFrame.isLeaf()) {
+                if (ctx.getInteriorFrame().isLeaf()) {
                     throw HyracksDataException.create(ErrorCode.FAILED_TO_RE_FIND_PARENT);
                 }
 
                 if (pageId != rootPage) {
-                    parentLsn = ctx.traverseList.getPageLsn(ctx.traverseList.getPageIndex(pageIndex));
+                    parentLsn = ctx.getTraverseList().getPageLsn(ctx.getTraverseList().getPageIndex(pageIndex));
                 }
-                if (pageId != rootPage && parentLsn < ctx.interiorFrame.getPageNsn()) {
-                    int rightPage = ctx.interiorFrame.getRightPage();
+                if (pageId != rootPage && parentLsn < ctx.getInteriorFrame().getPageNsn()) {
+                    int rightPage = ctx.getInteriorFrame().getRightPage();
                     if (rightPage != -1) {
-                        ctx.traverseList.addFirst(rightPage, -1, parentIndex);
+                        ctx.getTraverseList().addFirst(rightPage, -1, parentIndex);
                     }
                 }
 
-                if (ctx.interiorFrame.findTupleByPointer(ctx.splitKey.getLeftTuple(), ctx.traverseList, pageIndex,
-                        ctx.cmp) != -1) {
-                    ctx.pathList.clear();
+                if (ctx.getInteriorFrame().findTupleByPointer(ctx.getSplitKey().getLeftTuple(), ctx.getTraverseList(),
+                        pageIndex, ctx.getCmp()) != -1) {
+                    ctx.getPathList().clear();
                     fillPath(ctx, pageIndex);
                     return;
                 }
@@ -570,16 +573,17 @@
 
     private void fillPath(RTreeOpContext ctx, int pageIndex) {
         if (pageIndex != -1) {
-            fillPath(ctx, ctx.traverseList.getPageIndex(pageIndex));
-            ctx.pathList.add(ctx.traverseList.getPageId(pageIndex), ctx.traverseList.getPageLsn(pageIndex), -1);
+            fillPath(ctx, ctx.getTraverseList().getPageIndex(pageIndex));
+            ctx.getPathList().add(ctx.getTraverseList().getPageId(pageIndex),
+                    ctx.getTraverseList().getPageLsn(pageIndex), -1);
         }
     }
 
     private void delete(ITupleReference tuple, RTreeOpContext ctx) throws HyracksDataException {
         ctx.reset();
         ctx.setTuple(tuple);
-        ctx.splitKey.reset();
-        ctx.splitKey.getLeftTuple().setFieldCount(cmpFactories.length);
+        ctx.getSplitKey().reset();
+        ctx.getSplitKey().getLeftTuple().setFieldCount(cmpFactories.length);
 
         // We delete the first matching tuple (including the payload data).
         // We don't update the MBRs of the parents after deleting the record.
@@ -589,8 +593,8 @@
             try {
                 deleteTuple(tupleIndex, ctx);
             } finally {
-                ctx.leafFrame.getPage().releaseWriteLatch(true);
-                bufferCache.unpin(ctx.leafFrame.getPage());
+                ctx.getLeafFrame().getPage().releaseWriteLatch(true);
+                bufferCache.unpin(ctx.getLeafFrame().getPage());
             }
         }
     }
@@ -600,39 +604,40 @@
         boolean readLatched = false;
         boolean succeeded = false;
         ICachedPage node = null;
-        ctx.pathList.add(rootPage, -1, -1);
+        ctx.getPathList().add(rootPage, -1, -1);
 
         try {
-            while (!ctx.pathList.isEmpty()) {
-                int pageId = ctx.pathList.getLastPageId();
-                long parentLsn = ctx.pathList.getLastPageLsn();
-                ctx.pathList.moveLast();
+            while (!ctx.getPathList().isEmpty()) {
+                int pageId = ctx.getPathList().getLastPageId();
+                long parentLsn = ctx.getPathList().getLastPageLsn();
+                ctx.getPathList().moveLast();
                 node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
                 node.acquireReadLatch();
                 readLatched = true;
-                ctx.interiorFrame.setPage(node);
-                boolean isLeaf = ctx.interiorFrame.isLeaf();
-                long pageLsn = ctx.interiorFrame.getPageLsn();
+                ctx.getInteriorFrame().setPage(node);
+                boolean isLeaf = ctx.getInteriorFrame().isLeaf();
+                long pageLsn = ctx.getInteriorFrame().getPageLsn();
 
-                if (pageId != rootPage && parentLsn < ctx.interiorFrame.getPageNsn()) {
+                if (pageId != rootPage && parentLsn < ctx.getInteriorFrame().getPageNsn()) {
                     // Concurrent split detected, we need to visit the right
                     // page
-                    int rightPage = ctx.interiorFrame.getRightPage();
+                    int rightPage = ctx.getInteriorFrame().getRightPage();
                     if (rightPage != -1) {
-                        ctx.pathList.add(rightPage, parentLsn, -1);
+                        ctx.getPathList().add(rightPage, parentLsn, -1);
                     }
                 }
 
                 if (!isLeaf) {
-                    for (int i = 0; i < ctx.interiorFrame.getTupleCount(); i++) {
-                        int childPageId = ctx.interiorFrame.getChildPageIdIfIntersect(ctx.tuple, i, ctx.cmp);
+                    for (int i = 0; i < ctx.getInteriorFrame().getTupleCount(); i++) {
+                        int childPageId =
+                                ctx.getInteriorFrame().getChildPageIdIfIntersect(ctx.getTuple(), i, ctx.getCmp());
                         if (childPageId != -1) {
-                            ctx.pathList.add(childPageId, pageLsn, -1);
+                            ctx.getPathList().add(childPageId, pageLsn, -1);
                         }
                     }
                 } else {
-                    ctx.leafFrame.setPage(node);
-                    int tupleIndex = ctx.leafFrame.findTupleIndex(ctx.tuple, ctx.cmp);
+                    ctx.getLeafFrame().setPage(node);
+                    int tupleIndex = ctx.getLeafFrame().findTupleIndex(ctx.getTuple(), ctx.getCmp());
                     if (tupleIndex != -1) {
 
                         node.releaseReadLatch();
@@ -642,12 +647,12 @@
                         node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
                         node.acquireWriteLatch();
                         writeLatched = true;
-                        ctx.leafFrame.setPage(node);
+                        ctx.getLeafFrame().setPage(node);
 
                         // A rare case only happen when a root is no longer a
                         // leaf page. Simply we restart the search.
-                        if (!ctx.leafFrame.isLeaf()) {
-                            ctx.pathList.add(pageId, -1, -1);
+                        if (!ctx.getLeafFrame().isLeaf()) {
+                            ctx.getPathList().add(pageId, -1, -1);
 
                             node.releaseWriteLatch(true);
                             writeLatched = false;
@@ -655,12 +660,12 @@
                             continue;
                         }
 
-                        if (ctx.leafFrame.getPageLsn() != pageLsn) {
+                        if (ctx.getLeafFrame().getPageLsn() != pageLsn) {
                             // The page was changed while we unlocked it
 
-                            tupleIndex = ctx.leafFrame.findTupleIndex(ctx.tuple, ctx.cmp);
+                            tupleIndex = ctx.getLeafFrame().findTupleIndex(ctx.getTuple(), ctx.getCmp());
                             if (tupleIndex == -1) {
-                                ctx.pathList.add(pageId, parentLsn, -1);
+                                ctx.getPathList().add(pageId, parentLsn, -1);
 
                                 node.releaseWriteLatch(true);
                                 writeLatched = false;
@@ -697,21 +702,21 @@
     }
 
     private void deleteTuple(int tupleIndex, RTreeOpContext ctx) throws HyracksDataException {
-        ITupleReference beforeTuple = ctx.leafFrame.getBeforeTuple(ctx.getTuple(), tupleIndex, ctx.cmp);
-        ctx.modificationCallback.found(beforeTuple, ctx.getTuple());
-        ctx.leafFrame.delete(tupleIndex, ctx.cmp);
-        ctx.leafFrame.setPageLsn(incrementGlobalNsn());
+        ITupleReference beforeTuple = ctx.getLeafFrame().getBeforeTuple(ctx.getTuple(), tupleIndex, ctx.getCmp());
+        ctx.getModificationCallback().found(beforeTuple, ctx.getTuple());
+        ctx.getLeafFrame().delete(tupleIndex, ctx.getCmp());
+        ctx.getLeafFrame().setPageLsn(incrementGlobalNsn());
     }
 
     private void search(ITreeIndexCursor cursor, ISearchPredicate searchPred, RTreeOpContext ctx)
             throws HyracksDataException {
         ctx.reset();
-        ctx.cursor = cursor;
+        ctx.setCursor(cursor);
 
         cursor.setBufferCache(bufferCache);
         cursor.setFileId(fileId);
-        ctx.cursorInitialState.setRootPage(rootPage);
-        ctx.cursor.open(ctx.cursorInitialState, searchPred);
+        ctx.getCursorInitialState().setRootPage(rootPage);
+        ctx.getCursor().open(ctx.getCursorInitialState(), searchPred);
     }
 
     private void update(ITupleReference tuple, RTreeOpContext ctx) {
@@ -726,7 +731,7 @@
         SearchPredicate searchPred = new SearchPredicate(null, cmp);
 
         int currentPageId = bulkloadLeafStart;
-        int maxPageId = freePageManager.getMaxPageId(ctx.metaFrame);
+        int maxPageId = freePageManager.getMaxPageId(ctx.getMetaFrame());
 
         ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, currentPageId), false);
         page.acquireReadLatch();
@@ -735,9 +740,9 @@
             cursor.setFileId(fileId);
             cursor.setCurrentPageId(currentPageId);
             cursor.setMaxPageId(maxPageId);
-            ctx.cursorInitialState.setOriginialKeyComparator(ctx.cmp);
-            ctx.cursorInitialState.setPage(page);
-            cursor.open(ctx.cursorInitialState, searchPred);
+            ctx.getCursorInitialState().setOriginialKeyComparator(ctx.getCmp());
+            ctx.getCursorInitialState().setPage(page);
+            cursor.open(ctx.getCursorInitialState(), searchPred);
         } catch (Exception e) {
             page.releaseReadLatch();
             bufferCache.unpin(page);
@@ -820,22 +825,22 @@
 
         private void insert(ITupleReference tuple, IIndexOperationContext ictx) throws HyracksDataException {
             RTreeOpContext ctx = (RTreeOpContext) ictx;
-            int tupleSize = Math.max(ctx.leafFrame.getBytesRequiredToWriteTuple(tuple),
-                    ctx.interiorFrame.getBytesRequiredToWriteTuple(tuple));
+            int tupleSize = Math.max(ctx.getLeafFrame().getBytesRequiredToWriteTuple(tuple),
+                    ctx.getInteriorFrame().getBytesRequiredToWriteTuple(tuple));
             if (tupleSize > maxTupleSize) {
                 throw HyracksDataException.create(ErrorCode.RECORD_IS_TOO_LARGE, tupleSize, maxTupleSize);
             }
             ctx.reset();
             ctx.setTuple(tuple);
-            ctx.splitKey.reset();
-            ctx.splitKey.getLeftTuple().setFieldCount(cmpFactories.length);
-            ctx.splitKey.getRightTuple().setFieldCount(cmpFactories.length);
-            ctx.modificationCallback.before(tuple);
+            ctx.getSplitKey().reset();
+            ctx.getSplitKey().getLeftTuple().setFieldCount(cmpFactories.length);
+            ctx.getSplitKey().getRightTuple().setFieldCount(cmpFactories.length);
+            ctx.getModificationCallback().before(tuple);
 
             int maxFieldPos = cmpFactories.length / 2;
             for (int i = 0; i < maxFieldPos; i++) {
                 int j = maxFieldPos + i;
-                int c = ctx.cmp.getComparators()[i].compare(tuple.getFieldData(i), tuple.getFieldStart(i),
+                int c = ctx.getCmp().getComparators()[i].compare(tuple.getFieldData(i), tuple.getFieldStart(i),
                         tuple.getFieldLength(i), tuple.getFieldData(j), tuple.getFieldStart(j),
                         tuple.getFieldLength(j));
                 if (c > 0) {
@@ -847,28 +852,28 @@
             try {
                 ICachedPage leafNode = findLeaf(ctx);
 
-                int pageId = ctx.pathList.getLastPageId();
-                ctx.pathList.moveLast();
+                int pageId = ctx.getPathList().getLastPageId();
+                ctx.getPathList().moveLast();
                 insertTuple(leafNode, pageId, ctx.getTuple(), ctx, true);
 
                 while (true) {
-                    if (ctx.splitKey.getLeftPageBuffer() != null) {
+                    if (ctx.getSplitKey().getLeftPageBuffer() != null) {
                         updateParentForInsert(ctx);
                     } else {
                         break;
                     }
                 }
             } finally {
-                for (int i = ctx.NSNUpdates.size() - 1; i >= 0; i--) {
-                    ICachedPage node = ctx.NSNUpdates.get(i);
-                    ctx.interiorFrame.setPage(node);
-                    ctx.interiorFrame.setPageNsn(incrementGlobalNsn());
+                for (int i = ctx.getNSNUpdates().size() - 1; i >= 0; i--) {
+                    ICachedPage node = ctx.getNSNUpdates().get(i);
+                    ctx.getInteriorFrame().setPage(node);
+                    ctx.getInteriorFrame().setPageNsn(incrementGlobalNsn());
                 }
 
-                for (int i = ctx.LSNUpdates.size() - 1; i >= 0; i--) {
-                    ICachedPage node = ctx.LSNUpdates.get(i);
-                    ctx.interiorFrame.setPage(node);
-                    ctx.interiorFrame.setPageLsn(incrementGlobalNsn());
+                for (int i = ctx.getLSNUpdates().size() - 1; i >= 0; i--) {
+                    ICachedPage node = ctx.getLSNUpdates().get(i);
+                    ctx.getInteriorFrame().setPage(node);
+                    ctx.getInteriorFrame().setPageLsn(incrementGlobalNsn());
                     node.releaseWriteLatch(true);
                     bufferCache.unpin(node);
                 }
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java
index 4bc4d61..d23e3b7 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java
@@ -20,13 +20,14 @@
 package org.apache.hyracks.storage.am.rtree.impls;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
-import org.apache.hyracks.storage.am.common.api.IPageManager;
 import org.apache.hyracks.storage.am.common.api.IIndexOperationContext;
 import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback;
+import org.apache.hyracks.storage.am.common.api.IPageManager;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexMetadataFrame;
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
@@ -39,29 +40,28 @@
 public class RTreeOpContext implements IIndexOperationContext, IExtraPageBlockHelper {
     private static final int INITIAL_TRAVERSE_LIST_SIZE = 100;
     private static final int INITIAL_HEIGHT = 8;
-    public final MultiComparator cmp;
-    public final IRTreeInteriorFrame interiorFrame;
-    public final IRTreeLeafFrame leafFrame;
-    public IndexOperation op;
-    public ITreeIndexCursor cursor;
-    public RTreeCursorInitialState cursorInitialState;
-    public final IPageManager freePageManager;
-    public final ITreeIndexMetadataFrame metaFrame;
-    public RTreeSplitKey splitKey;
-    public ITupleReference tuple;
+    private final MultiComparator cmp;
+    private final IRTreeInteriorFrame interiorFrame;
+    private final IRTreeLeafFrame leafFrame;
+    private IndexOperation op;
+    private ITreeIndexCursor cursor;
+    private RTreeCursorInitialState cursorInitialState;
+    private final IPageManager freePageManager;
+    private final ITreeIndexMetadataFrame metaFrame;
+    private RTreeSplitKey splitKey;
+    private ITupleReference tuple;
     // Used to record the pageIds and pageLsns of the visited pages.
-    public PathList pathList;
+    private PathList pathList;
     // Used for traversing the tree.
-    public PathList traverseList;
+    private PathList traverseList;
 
-    public ArrayList<ICachedPage> NSNUpdates;
-    public ArrayList<ICachedPage> LSNUpdates;
+    private ArrayList<ICachedPage> NSNUpdates;
+    private ArrayList<ICachedPage> LSNUpdates;
 
-    public IModificationOperationCallback modificationCallback;
+    private IModificationOperationCallback modificationCallback;
 
-    public RTreeOpContext(IRTreeLeafFrame leafFrame, IRTreeInteriorFrame interiorFrame,
-            IPageManager freePageManager, IBinaryComparatorFactory[] cmpFactories,
-                          IModificationOperationCallback modificationCallback) {
+    public RTreeOpContext(IRTreeLeafFrame leafFrame, IRTreeInteriorFrame interiorFrame, IPageManager freePageManager,
+            IBinaryComparatorFactory[] cmpFactories, IModificationOperationCallback modificationCallback) {
 
         if (cmpFactories[0] != null) {
             this.cmp = MultiComparator.create(cmpFactories);
@@ -106,8 +106,8 @@
         }
         if (op != IndexOperation.SEARCH && op != IndexOperation.DISKORDERSCAN) {
             if (splitKey == null) {
-                splitKey = new RTreeSplitKey(interiorFrame.getTupleWriter().createTupleReference(), interiorFrame
-                        .getTupleWriter().createTupleReference());
+                splitKey = new RTreeSplitKey(interiorFrame.getTupleWriter().createTupleReference(),
+                        interiorFrame.getTupleWriter().createTupleReference());
             }
             if (traverseList == null) {
                 traverseList = new PathList(INITIAL_TRAVERSE_LIST_SIZE, INITIAL_TRAVERSE_LIST_SIZE);
@@ -137,4 +137,56 @@
     public void returnFreePageBlock(int blockPageId, int size) throws HyracksDataException {
         freePageManager.releaseBlock(metaFrame, blockPageId, size);
     }
+
+    public IRTreeInteriorFrame getInteriorFrame() {
+        return interiorFrame;
+    }
+
+    public PathList getPathList() {
+        return pathList;
+    }
+
+    public MultiComparator getCmp() {
+        return cmp;
+    }
+
+    public IRTreeLeafFrame getLeafFrame() {
+        return leafFrame;
+    }
+
+    public IModificationOperationCallback getModificationCallback() {
+        return modificationCallback;
+    }
+
+    public List<ICachedPage> getLSNUpdates() {
+        return LSNUpdates;
+    }
+
+    public RTreeSplitKey getSplitKey() {
+        return splitKey;
+    }
+
+    public ITreeIndexMetadataFrame getMetaFrame() {
+        return metaFrame;
+    }
+
+    public List<ICachedPage> getNSNUpdates() {
+        return NSNUpdates;
+    }
+
+    public PathList getTraverseList() {
+        return traverseList;
+    }
+
+    public ITreeIndexCursor getCursor() {
+        return cursor;
+    }
+
+    public void setCursor(ITreeIndexCursor cursor) {
+        this.cursor = cursor;
+    }
+
+    public RTreeCursorInitialState getCursorInitialState() {
+        return cursorInitialState;
+    }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/org/apache/hyracks/storage/am/btree/multithread/BTreeTestWorker.java b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/org/apache/hyracks/storage/am/btree/multithread/BTreeTestWorker.java
index 3734f08..f6c6e09 100644
--- a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/org/apache/hyracks/storage/am/btree/multithread/BTreeTestWorker.java
+++ b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/org/apache/hyracks/storage/am/btree/multithread/BTreeTestWorker.java
@@ -54,7 +54,7 @@
         BTree.BTreeAccessor accessor = (BTree.BTreeAccessor) indexAccessor;
         ITreeIndexCursor searchCursor = accessor.createSearchCursor(false);
         ITreeIndexCursor diskOrderScanCursor = accessor.createDiskOrderScanCursor();
-        MultiComparator cmp = accessor.getOpContext().cmp;
+        MultiComparator cmp = accessor.getOpContext().getCmp();
         RangePredicate rangePred = new RangePredicate(tuple, tuple, true, true, cmp, cmp);
 
         switch (op) {
diff --git a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/org/apache/hyracks/storage/am/rtree/multithread/RTreeTestWorker.java b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/org/apache/hyracks/storage/am/rtree/multithread/RTreeTestWorker.java
index 898c051..121158d 100644
--- a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/org/apache/hyracks/storage/am/rtree/multithread/RTreeTestWorker.java
+++ b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/org/apache/hyracks/storage/am/rtree/multithread/RTreeTestWorker.java
@@ -54,7 +54,7 @@
         RTree.RTreeAccessor accessor = (RTree.RTreeAccessor) indexAccessor;
         IIndexCursor searchCursor = accessor.createSearchCursor(false);
         ITreeIndexCursor diskOrderScanCursor = accessor.createDiskOrderScanCursor();
-        MultiComparator cmp = accessor.getOpContext().cmp;
+        MultiComparator cmp = accessor.getOpContext().getCmp();
         SearchPredicate rangePred = new SearchPredicate(tuple, cmp);
 
         switch (op) {
