diff --git a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java
index 6f371c0..05b16c8 100644
--- a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java
+++ b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java
@@ -156,12 +156,12 @@
         IFileSplitProvider primarySplitProvider = JobHelper.createFileSplitProvider(splitNCs, options.primaryBTreeName);
 
         ITreeIndexOpHelperFactory opHelperFactory = new BTreeOpHelperFactory();
-        
+
         // create operator descriptor
-        TreeIndexInsertUpdateDeleteOperatorDescriptor primaryInsert = new TreeIndexInsertUpdateDeleteOperatorDescriptor(spec,
-                recDesc, storageManager, treeIndexRegistryProvider, primarySplitProvider, primaryInteriorFrameFactory,
-                primaryLeafFrameFactory, primaryTypeTraits, primaryComparatorFactories, primaryFieldPermutation,
-                IndexOp.INSERT, opHelperFactory);
+        TreeIndexInsertUpdateDeleteOperatorDescriptor primaryInsert = new TreeIndexInsertUpdateDeleteOperatorDescriptor(
+                spec, recDesc, storageManager, treeIndexRegistryProvider, primarySplitProvider,
+                primaryInteriorFrameFactory, primaryLeafFrameFactory, primaryTypeTraits, primaryComparatorFactories,
+                null, primaryFieldPermutation, IndexOp.INSERT, opHelperFactory);
         JobHelper.createPartitionConstraint(spec, primaryInsert, splitNCs);
 
         // prepare insertion into secondary index
@@ -187,10 +187,10 @@
         IFileSplitProvider secondarySplitProvider = JobHelper.createFileSplitProvider(splitNCs,
                 options.secondaryBTreeName);
         // create operator descriptor
-        TreeIndexInsertUpdateDeleteOperatorDescriptor secondaryInsert = new TreeIndexInsertUpdateDeleteOperatorDescriptor(spec,
-                recDesc, storageManager, treeIndexRegistryProvider, secondarySplitProvider, secondaryInteriorFrameFactory,
-                secondaryLeafFrameFactory, secondaryTypeTraits, secondaryComparatorFactories,
-                secondaryFieldPermutation, IndexOp.INSERT, opHelperFactory);
+        TreeIndexInsertUpdateDeleteOperatorDescriptor secondaryInsert = new TreeIndexInsertUpdateDeleteOperatorDescriptor(
+                spec, recDesc, storageManager, treeIndexRegistryProvider, secondarySplitProvider,
+                secondaryInteriorFrameFactory, secondaryLeafFrameFactory, secondaryTypeTraits,
+                secondaryComparatorFactories, null, secondaryFieldPermutation, IndexOp.INSERT, opHelperFactory);
         JobHelper.createPartitionConstraint(spec, secondaryInsert, splitNCs);
 
         // end the insert pipeline at this sink operator
@@ -216,4 +216,4 @@
 
         return spec;
     }
-}
+}
\ No newline at end of file
diff --git a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java
index f7942eb..8019080 100644
--- a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java
+++ b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java
@@ -154,12 +154,12 @@
         // tuple
         int[] fieldPermutation = { 2, 1, 3, 4 }; // map field 2 of input tuple
                                                  // to field 0 of B-Tree tuple,
-                                                 // etc.                
+                                                 // etc.
         IFileSplitProvider btreeSplitProvider = JobHelper.createFileSplitProvider(splitNCs, options.btreeName);
         ITreeIndexOpHelperFactory opHelperFactory = new BTreeOpHelperFactory();
-        TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec, storageManager,
-                treeIndexRegistryProvider, btreeSplitProvider, interiorFrameFactory, leafFrameFactory, typeTraits,
-                comparatorFactories, fieldPermutation, 0.7f, opHelperFactory);
+        TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec,
+                storageManager, treeIndexRegistryProvider, btreeSplitProvider, interiorFrameFactory, leafFrameFactory,
+                typeTraits, comparatorFactories, null, fieldPermutation, 0.7f, opHelperFactory);
         JobHelper.createPartitionConstraint(spec, btreeBulkLoad, splitNCs);
 
         // distribute the records from the datagen via hashing to the bulk load
diff --git a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java
index cae9660..b75f64d 100644
--- a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java
+++ b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java
@@ -110,9 +110,9 @@
 
         IFileSplitProvider btreeSplitProvider = JobHelper.createFileSplitProvider(splitNCs, options.btreeName);
         ITreeIndexOpHelperFactory opHelperFactory = new BTreeOpHelperFactory();
-        TreeIndexFileEnlistmentOperatorDescriptor fileEnlistmentOp = new TreeIndexFileEnlistmentOperatorDescriptor(spec,
-                recDesc, storageManager, treeIndexRegistryProvider, btreeSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
+        TreeIndexFileEnlistmentOperatorDescriptor fileEnlistmentOp = new TreeIndexFileEnlistmentOperatorDescriptor(
+                spec, recDesc, storageManager, treeIndexRegistryProvider, btreeSplitProvider, interiorFrameFactory,
+                leafFrameFactory, typeTraits, comparatorFactories, null, opHelperFactory);
         JobHelper.createPartitionConstraint(spec, fileEnlistmentOp, splitNCs);
 
         spec.addRoot(fileEnlistmentOp);
diff --git a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java
index 47fecad..21c00a1 100644
--- a/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java
+++ b/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java
@@ -96,7 +96,7 @@
         JobSpecification spec = new JobSpecification();
 
         String[] splitNCs = options.ncs.split(",");
-        
+
         IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider = TreeIndexRegistryProvider.INSTANCE;
         IStorageManagerInterface storageManager = StorageManagerInterface.INSTANCE;
 
@@ -125,8 +125,8 @@
         // use a disk-order scan to read primary index
         IFileSplitProvider primarySplitProvider = JobHelper.createFileSplitProvider(splitNCs, options.primaryBTreeName);
         ITreeIndexOpHelperFactory opHelperFactory = new BTreeOpHelperFactory();
-        TreeIndexDiskOrderScanOperatorDescriptor btreeScanOp = new TreeIndexDiskOrderScanOperatorDescriptor(spec, recDesc,
-                storageManager, treeIndexRegistryProvider, primarySplitProvider, primaryInteriorFrameFactory,
+        TreeIndexDiskOrderScanOperatorDescriptor btreeScanOp = new TreeIndexDiskOrderScanOperatorDescriptor(spec,
+                recDesc, storageManager, treeIndexRegistryProvider, primarySplitProvider, primaryInteriorFrameFactory,
                 primaryLeafFrameFactory, primaryTypeTraits, opHelperFactory);
         JobHelper.createPartitionConstraint(spec, btreeScanOp, splitNCs);
 
@@ -157,9 +157,10 @@
         // tuple
         int[] fieldPermutation = { 1, 0 };
         IFileSplitProvider btreeSplitProvider = JobHelper.createFileSplitProvider(splitNCs, options.secondaryBTreeName);
-        TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec, storageManager,
-                treeIndexRegistryProvider, btreeSplitProvider, secondaryInteriorFrameFactory, secondaryLeafFrameFactory,
-                secondaryTypeTraits, comparatorFactories, fieldPermutation, 0.7f, opHelperFactory);
+        TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec,
+                storageManager, treeIndexRegistryProvider, btreeSplitProvider, secondaryInteriorFrameFactory,
+                secondaryLeafFrameFactory, secondaryTypeTraits, comparatorFactories, null, fieldPermutation, 0.7f,
+                opHelperFactory);
         JobHelper.createPartitionConstraint(spec, btreeBulkLoad, splitNCs);
 
         // connect the ops
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexScanOperatorTest.java
similarity index 79%
copy from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java
copy to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexScanOperatorTest.java
index e835d1c..ba7621d 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexScanOperatorTest.java
@@ -55,7 +55,6 @@
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.ITreeIndexOpHelperFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexBulkLoadOperatorDescriptor;
-import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexStatsOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.common.tuples.TypeAwareTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
@@ -63,7 +62,7 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class BTreePrimaryIndexOperatorsTest extends AbstractIntegrationTest {
+public class BTreePrimaryIndexScanOperatorTest extends AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -116,7 +115,7 @@
 		primaryTypeTraits[4] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
 		primaryTypeTraits[5] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
 		primaryComparatorFactories[0] = UTF8StringBinaryComparatorFactory.INSTANCE;
-		
+
 		loadPrimaryIndexTest();
 	}
 
@@ -169,7 +168,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
+				primaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBtreeBulkLoad, NC1_ID);
@@ -185,22 +184,6 @@
 	}
 
 	@Test
-	public void showPrimaryIndexStats() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		TreeIndexStatsOperatorDescriptor primaryStatsOp = new TreeIndexStatsOperatorDescriptor(
-				spec, storageManager, treeIndexRegistryProvider,
-				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
-				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryStatsOp, NC1_ID);
-
-		spec.addRoot(primaryStatsOp);
-		runTest(spec);
-	}
-
-	@Test
 	public void scanPrimaryIndexTest() throws Exception {
 		JobSpecification spec = new JobSpecification();
 
@@ -248,60 +231,6 @@
 		runTest(spec);
 	}
 
-	@Test
-	public void searchPrimaryIndexTest() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		// build tuple containing low and high search key
-		// high key and low key
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount * 2);
-		DataOutput dos = tb.getDataOutput();
-
-		tb.reset();
-		// low key
-		UTF8StringSerializerDeserializer.INSTANCE.serialize("100", dos);
-		tb.addFieldEndOffset();
-		// high key
-		UTF8StringSerializerDeserializer.INSTANCE.serialize("200", dos);
-		tb.addFieldEndOffset();
-
-		ISerializerDeserializer[] keyRecDescSers = {
-				UTF8StringSerializerDeserializer.INSTANCE,
-				UTF8StringSerializerDeserializer.INSTANCE };
-		RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
-
-		ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
-				spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
-				tb.getSize());
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				keyProviderOp, NC1_ID);
-
-		int[] lowKeyFields = { 0 };
-		int[] highKeyFields = { 1 };
-
-		BTreeSearchOperatorDescriptor primaryBtreeSearchOp = new BTreeSearchOperatorDescriptor(
-				spec, primaryRecDesc, storageManager,
-				treeIndexRegistryProvider, primaryBtreeSplitProvider,
-				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, true,
-				lowKeyFields, highKeyFields, true, true, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryBtreeSearchOp, NC1_ID);
-
-		PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer,
-				NC1_ID);
-
-		spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0,
-				primaryBtreeSearchOp, 0);
-		spec.connect(new OneToOneConnectorDescriptor(spec),
-				primaryBtreeSearchOp, 0, printer, 0);
-
-		spec.addRoot(printer);
-		runTest(spec);
-	}
-
-
 	@AfterClass
 	public static void cleanup() throws Exception {
 		File primary = new File(primaryFileName);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexSearchOperatorTest.java
similarity index 80%
rename from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java
rename to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexSearchOperatorTest.java
index e835d1c..c64424d 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexSearchOperatorTest.java
@@ -55,7 +55,6 @@
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.ITreeIndexOpHelperFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexBulkLoadOperatorDescriptor;
-import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexStatsOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.common.tuples.TypeAwareTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
@@ -63,7 +62,8 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class BTreePrimaryIndexOperatorsTest extends AbstractIntegrationTest {
+public class BTreePrimaryIndexSearchOperatorTest extends
+		AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -116,7 +116,7 @@
 		primaryTypeTraits[4] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
 		primaryTypeTraits[5] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
 		primaryComparatorFactories[0] = UTF8StringBinaryComparatorFactory.INSTANCE;
-		
+
 		loadPrimaryIndexTest();
 	}
 
@@ -169,7 +169,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
+				primaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBtreeBulkLoad, NC1_ID);
@@ -185,70 +185,6 @@
 	}
 
 	@Test
-	public void showPrimaryIndexStats() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		TreeIndexStatsOperatorDescriptor primaryStatsOp = new TreeIndexStatsOperatorDescriptor(
-				spec, storageManager, treeIndexRegistryProvider,
-				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
-				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryStatsOp, NC1_ID);
-
-		spec.addRoot(primaryStatsOp);
-		runTest(spec);
-	}
-
-	@Test
-	public void scanPrimaryIndexTest() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		// build dummy tuple containing nothing
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount * 2);
-		DataOutput dos = tb.getDataOutput();
-
-		tb.reset();
-		UTF8StringSerializerDeserializer.INSTANCE.serialize("0", dos);
-		tb.addFieldEndOffset();
-
-		ISerializerDeserializer[] keyRecDescSers = {
-				UTF8StringSerializerDeserializer.INSTANCE,
-				UTF8StringSerializerDeserializer.INSTANCE };
-		RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
-
-		ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
-				spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
-				tb.getSize());
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				keyProviderOp, NC1_ID);
-
-		int[] lowKeyFields = null; // - infinity
-		int[] highKeyFields = null; // + infinity
-
-		BTreeSearchOperatorDescriptor primaryBtreeSearchOp = new BTreeSearchOperatorDescriptor(
-				spec, primaryRecDesc, storageManager,
-				treeIndexRegistryProvider, primaryBtreeSplitProvider,
-				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, true,
-				lowKeyFields, highKeyFields, true, true, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryBtreeSearchOp, NC1_ID);
-
-		PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer,
-				NC1_ID);
-
-		spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0,
-				primaryBtreeSearchOp, 0);
-		spec.connect(new OneToOneConnectorDescriptor(spec),
-				primaryBtreeSearchOp, 0, printer, 0);
-
-		spec.addRoot(printer);
-		runTest(spec);
-	}
-
-	@Test
 	public void searchPrimaryIndexTest() throws Exception {
 		JobSpecification spec = new JobSpecification();
 
@@ -301,7 +237,6 @@
 		runTest(spec);
 	}
 
-
 	@AfterClass
 	public static void cleanup() throws Exception {
 		File primary = new File(primaryFileName);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexStatsOperatorTest.java
similarity index 68%
copy from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java
copy to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexStatsOperatorTest.java
index e835d1c..e8fd60b 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreePrimaryIndexStatsOperatorTest.java
@@ -15,7 +15,6 @@
 
 package edu.uci.ics.hyracks.tests.btree;
 
-import java.io.DataOutput;
 import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -32,7 +31,6 @@
 import edu.uci.ics.hyracks.api.dataflow.value.TypeTrait;
 import edu.uci.ics.hyracks.api.io.FileReference;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
-import edu.uci.ics.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
 import edu.uci.ics.hyracks.dataflow.common.data.comparators.UTF8StringBinaryComparatorFactory;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.parsers.IValueParserFactory;
@@ -43,11 +41,8 @@
 import edu.uci.ics.hyracks.dataflow.std.file.FileScanOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
-import edu.uci.ics.hyracks.dataflow.std.misc.ConstantTupleSourceOperatorDescriptor;
-import edu.uci.ics.hyracks.dataflow.std.misc.PrinterOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.sort.ExternalSortOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.btree.dataflow.BTreeOpHelperFactory;
-import edu.uci.ics.hyracks.storage.am.btree.dataflow.BTreeSearchOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMLeafFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
@@ -63,7 +58,7 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class BTreePrimaryIndexOperatorsTest extends AbstractIntegrationTest {
+public class BTreePrimaryIndexStatsOperatorTest extends AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -116,7 +111,7 @@
 		primaryTypeTraits[4] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
 		primaryTypeTraits[5] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
 		primaryComparatorFactories[0] = UTF8StringBinaryComparatorFactory.INSTANCE;
-		
+
 		loadPrimaryIndexTest();
 	}
 
@@ -169,7 +164,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
+				primaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBtreeBulkLoad, NC1_ID);
@@ -200,108 +195,6 @@
 		runTest(spec);
 	}
 
-	@Test
-	public void scanPrimaryIndexTest() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		// build dummy tuple containing nothing
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount * 2);
-		DataOutput dos = tb.getDataOutput();
-
-		tb.reset();
-		UTF8StringSerializerDeserializer.INSTANCE.serialize("0", dos);
-		tb.addFieldEndOffset();
-
-		ISerializerDeserializer[] keyRecDescSers = {
-				UTF8StringSerializerDeserializer.INSTANCE,
-				UTF8StringSerializerDeserializer.INSTANCE };
-		RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
-
-		ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
-				spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
-				tb.getSize());
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				keyProviderOp, NC1_ID);
-
-		int[] lowKeyFields = null; // - infinity
-		int[] highKeyFields = null; // + infinity
-
-		BTreeSearchOperatorDescriptor primaryBtreeSearchOp = new BTreeSearchOperatorDescriptor(
-				spec, primaryRecDesc, storageManager,
-				treeIndexRegistryProvider, primaryBtreeSplitProvider,
-				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, true,
-				lowKeyFields, highKeyFields, true, true, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryBtreeSearchOp, NC1_ID);
-
-		PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer,
-				NC1_ID);
-
-		spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0,
-				primaryBtreeSearchOp, 0);
-		spec.connect(new OneToOneConnectorDescriptor(spec),
-				primaryBtreeSearchOp, 0, printer, 0);
-
-		spec.addRoot(printer);
-		runTest(spec);
-	}
-
-	@Test
-	public void searchPrimaryIndexTest() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		// build tuple containing low and high search key
-		// high key and low key
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount * 2);
-		DataOutput dos = tb.getDataOutput();
-
-		tb.reset();
-		// low key
-		UTF8StringSerializerDeserializer.INSTANCE.serialize("100", dos);
-		tb.addFieldEndOffset();
-		// high key
-		UTF8StringSerializerDeserializer.INSTANCE.serialize("200", dos);
-		tb.addFieldEndOffset();
-
-		ISerializerDeserializer[] keyRecDescSers = {
-				UTF8StringSerializerDeserializer.INSTANCE,
-				UTF8StringSerializerDeserializer.INSTANCE };
-		RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
-
-		ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
-				spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
-				tb.getSize());
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				keyProviderOp, NC1_ID);
-
-		int[] lowKeyFields = { 0 };
-		int[] highKeyFields = { 1 };
-
-		BTreeSearchOperatorDescriptor primaryBtreeSearchOp = new BTreeSearchOperatorDescriptor(
-				spec, primaryRecDesc, storageManager,
-				treeIndexRegistryProvider, primaryBtreeSplitProvider,
-				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, true,
-				lowKeyFields, highKeyFields, true, true, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryBtreeSearchOp, NC1_ID);
-
-		PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer,
-				NC1_ID);
-
-		spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0,
-				primaryBtreeSearchOp, 0);
-		spec.connect(new OneToOneConnectorDescriptor(spec),
-				primaryBtreeSearchOp, 0, printer, 0);
-
-		spec.addRoot(printer);
-		runTest(spec);
-	}
-
-
 	@AfterClass
 	public static void cleanup() throws Exception {
 		File primary = new File(primaryFileName);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeUpdateSecondaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryIndexInsertOperatorTest.java
similarity index 98%
rename from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeUpdateSecondaryIndexOperatorsTest.java
rename to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryIndexInsertOperatorTest.java
index b9c61e7..5c527cb 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeUpdateSecondaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryIndexInsertOperatorTest.java
@@ -65,7 +65,7 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class BTreeUpdateSecondaryIndexOperatorsTest extends
+public class BTreeSecondaryIndexInsertOperatorTest extends
 		AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
@@ -206,7 +206,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
+				primaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBtreeBulkLoad, NC1_ID);
@@ -272,7 +272,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				secondaryBtreeSplitProvider, secondaryInteriorFrameFactory,
 				secondaryLeafFrameFactory, secondaryTypeTraits,
-				secondaryComparatorFactories, fieldPermutation, 0.7f,
+				secondaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				secondaryBtreeBulkLoad, NC1_ID);
@@ -330,7 +330,7 @@
 				spec, ordersDesc, storageManager, treeIndexRegistryProvider,
 				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, primaryFieldPermutation,
+				primaryComparatorFactories, null, primaryFieldPermutation,
 				IndexOp.INSERT, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBtreeInsertOp, NC1_ID);
@@ -341,7 +341,7 @@
 				spec, ordersDesc, storageManager, treeIndexRegistryProvider,
 				secondaryBtreeSplitProvider, secondaryInteriorFrameFactory,
 				secondaryLeafFrameFactory, secondaryTypeTraits,
-				secondaryComparatorFactories, fieldPermutationB,
+				secondaryComparatorFactories, null, fieldPermutationB,
 				IndexOp.INSERT, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				secondaryInsertOp, NC1_ID);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryIndexSearchOperatorTest.java
similarity index 98%
rename from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryOperatorsTest.java
rename to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryIndexSearchOperatorTest.java
index bdd1ac3..60c3b13 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeSecondaryIndexSearchOperatorTest.java
@@ -62,7 +62,8 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class BTreeSecondaryOperatorsTest extends AbstractIntegrationTest {
+public class BTreeSecondaryIndexSearchOperatorTest extends
+		AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -201,7 +202,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryBtreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
+				primaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBtreeBulkLoad, NC1_ID);
@@ -267,7 +268,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				secondaryBtreeSplitProvider, secondaryInteriorFrameFactory,
 				secondaryLeafFrameFactory, secondaryTypeTraits,
-				secondaryComparatorFactories, fieldPermutation, 0.7f,
+				secondaryComparatorFactories, null, fieldPermutation, 0.7f,
 				opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				secondaryBtreeBulkLoad, NC1_ID);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexSearchOperatorTest.java
similarity index 88%
rename from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexOperatorsTest.java
rename to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexSearchOperatorTest.java
index 71a9d89..1923c10 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexSearchOperatorTest.java
@@ -47,17 +47,17 @@
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
 import edu.uci.ics.hyracks.dataflow.std.misc.ConstantTupleSourceOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.misc.PrinterOperatorDescriptor;
-import edu.uci.ics.hyracks.storage.am.btree.dataflow.BTreeOpHelperFactory;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.ITreeIndexOpHelperFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexBulkLoadOperatorDescriptor;
-import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexStatsOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.rtree.dataflow.RTreeOpHelperFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.dataflow.RTreeSearchOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
@@ -65,7 +65,8 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class RTreePrimaryIndexOperatorsTest extends AbstractIntegrationTest {
+public class RTreePrimaryIndexSearchOperatorTest extends
+		AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -73,7 +74,6 @@
 	private IStorageManagerInterface storageManager = new TestStorageManagerInterface();
 	private IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider = new TestTreeIndexRegistryProvider();
 	private ITreeIndexOpHelperFactory opHelperFactory = new RTreeOpHelperFactory();
-	private ITreeIndexOpHelperFactory bTreeopHelperFactory = new BTreeOpHelperFactory();
 
 	private final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
 			"ddMMyy-hhmmssSS");
@@ -84,6 +84,7 @@
 	private int primaryKeyFieldCount = 4;
 	private ITypeTrait[] primaryTypeTraits = new ITypeTrait[primaryFieldCount];
 	private IBinaryComparatorFactory[] primaryComparatorFactories = new IBinaryComparatorFactory[primaryKeyFieldCount];
+	private IPrimitiveValueProviderFactory[] primaryValueProviderFactories = new IPrimitiveValueProviderFactory[primaryKeyFieldCount];
 
 	private RTreeTypeAwareTupleWriterFactory primaryTupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 			primaryTypeTraits);
@@ -97,11 +98,9 @@
 					UTF8StringSerializerDeserializer.INSTANCE });
 
 	private ITreeIndexFrameFactory primaryInteriorFrameFactory = new RTreeNSMInteriorFrameFactory(
-			primaryTupleWriterFactory, primaryRecDesc.getFields(),
-			primaryKeyFieldCount);
+			primaryTupleWriterFactory, primaryKeyFieldCount);
 	private ITreeIndexFrameFactory primaryLeafFrameFactory = new RTreeNSMLeafFrameFactory(
-			primaryTupleWriterFactory, primaryRecDesc.getFields(),
-			primaryKeyFieldCount);
+			primaryTupleWriterFactory, primaryKeyFieldCount);
 
 	private static String primaryRTreeName = "primary"
 			+ simpleDateFormat.format(new Date());
@@ -124,6 +123,10 @@
 		primaryComparatorFactories[1] = primaryComparatorFactories[0];
 		primaryComparatorFactories[2] = primaryComparatorFactories[0];
 		primaryComparatorFactories[3] = primaryComparatorFactories[0];
+		primaryValueProviderFactories[0] = DoublePrimitiveValueProviderFactory.INSTANCE;
+		primaryValueProviderFactories[1] = primaryValueProviderFactories[0];
+		primaryValueProviderFactories[2] = primaryValueProviderFactories[0];
+		primaryValueProviderFactories[3] = primaryValueProviderFactories[0];
 
 		loadPrimaryIndexTest();
 	}
@@ -159,8 +162,8 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryRTreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
-				opHelperFactory);
+				primaryComparatorFactories, primaryValueProviderFactories,
+				fieldPermutation, 0.7f, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryRTreeBulkLoad, NC1_ID);
 
@@ -172,22 +175,6 @@
 	}
 
 	@Test
-	public void showPrimaryIndexStats() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		TreeIndexStatsOperatorDescriptor primaryStatsOp = new TreeIndexStatsOperatorDescriptor(
-				spec, storageManager, treeIndexRegistryProvider,
-				primaryRTreeSplitProvider, primaryInteriorFrameFactory,
-				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryStatsOp, NC1_ID);
-
-		spec.addRoot(primaryStatsOp);
-		runTest(spec);
-	}
-
-	@Test
 	public void searchPrimaryIndexTest() throws Exception {
 		JobSpecification spec = new JobSpecification();
 
@@ -224,8 +211,8 @@
 				spec, primaryRecDesc, storageManager,
 				treeIndexRegistryProvider, primaryRTreeSplitProvider,
 				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, keyFields,
-				opHelperFactory);
+				primaryTypeTraits, primaryComparatorFactories,
+				primaryValueProviderFactories, keyFields, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryRTreeSearchOp, NC1_ID);
 
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexStatsOperatorTest.java
similarity index 74%
copy from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexOperatorsTest.java
copy to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexStatsOperatorTest.java
index 71a9d89..b6b4e20 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreePrimaryIndexStatsOperatorTest.java
@@ -15,7 +15,6 @@
 
 package edu.uci.ics.hyracks.tests.rtree;
 
-import java.io.DataOutput;
 import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -32,7 +31,6 @@
 import edu.uci.ics.hyracks.api.dataflow.value.TypeTrait;
 import edu.uci.ics.hyracks.api.io.FileReference;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
-import edu.uci.ics.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
 import edu.uci.ics.hyracks.dataflow.common.data.comparators.DoubleBinaryComparatorFactory;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
@@ -45,9 +43,7 @@
 import edu.uci.ics.hyracks.dataflow.std.file.FileScanOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
-import edu.uci.ics.hyracks.dataflow.std.misc.ConstantTupleSourceOperatorDescriptor;
-import edu.uci.ics.hyracks.dataflow.std.misc.PrinterOperatorDescriptor;
-import edu.uci.ics.hyracks.storage.am.btree.dataflow.BTreeOpHelperFactory;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
@@ -55,9 +51,9 @@
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexBulkLoadOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexStatsOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.rtree.dataflow.RTreeOpHelperFactory;
-import edu.uci.ics.hyracks.storage.am.rtree.dataflow.RTreeSearchOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
@@ -65,7 +61,7 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class RTreePrimaryIndexOperatorsTest extends AbstractIntegrationTest {
+public class RTreePrimaryIndexStatsOperatorTest extends AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -73,7 +69,6 @@
 	private IStorageManagerInterface storageManager = new TestStorageManagerInterface();
 	private IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider = new TestTreeIndexRegistryProvider();
 	private ITreeIndexOpHelperFactory opHelperFactory = new RTreeOpHelperFactory();
-	private ITreeIndexOpHelperFactory bTreeopHelperFactory = new BTreeOpHelperFactory();
 
 	private final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
 			"ddMMyy-hhmmssSS");
@@ -84,6 +79,7 @@
 	private int primaryKeyFieldCount = 4;
 	private ITypeTrait[] primaryTypeTraits = new ITypeTrait[primaryFieldCount];
 	private IBinaryComparatorFactory[] primaryComparatorFactories = new IBinaryComparatorFactory[primaryKeyFieldCount];
+	private IPrimitiveValueProviderFactory[] primaryValueProviderFactories = new IPrimitiveValueProviderFactory[primaryKeyFieldCount];
 
 	private RTreeTypeAwareTupleWriterFactory primaryTupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 			primaryTypeTraits);
@@ -97,11 +93,9 @@
 					UTF8StringSerializerDeserializer.INSTANCE });
 
 	private ITreeIndexFrameFactory primaryInteriorFrameFactory = new RTreeNSMInteriorFrameFactory(
-			primaryTupleWriterFactory, primaryRecDesc.getFields(),
-			primaryKeyFieldCount);
+			primaryTupleWriterFactory, primaryKeyFieldCount);
 	private ITreeIndexFrameFactory primaryLeafFrameFactory = new RTreeNSMLeafFrameFactory(
-			primaryTupleWriterFactory, primaryRecDesc.getFields(),
-			primaryKeyFieldCount);
+			primaryTupleWriterFactory, primaryKeyFieldCount);
 
 	private static String primaryRTreeName = "primary"
 			+ simpleDateFormat.format(new Date());
@@ -124,6 +118,10 @@
 		primaryComparatorFactories[1] = primaryComparatorFactories[0];
 		primaryComparatorFactories[2] = primaryComparatorFactories[0];
 		primaryComparatorFactories[3] = primaryComparatorFactories[0];
+		primaryValueProviderFactories[0] = DoublePrimitiveValueProviderFactory.INSTANCE;
+		primaryValueProviderFactories[1] = primaryValueProviderFactories[0];
+		primaryValueProviderFactories[2] = primaryValueProviderFactories[0];
+		primaryValueProviderFactories[3] = primaryValueProviderFactories[0];
 
 		loadPrimaryIndexTest();
 	}
@@ -159,8 +157,8 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryRTreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
-				opHelperFactory);
+				primaryComparatorFactories, primaryValueProviderFactories,
+				fieldPermutation, 0.7f, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryRTreeBulkLoad, NC1_ID);
 
@@ -187,61 +185,6 @@
 		runTest(spec);
 	}
 
-	@Test
-	public void searchPrimaryIndexTest() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		// build tuple
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount);
-		DataOutput dos = tb.getDataOutput();
-
-		tb.reset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(61.2894, dos);
-		tb.addFieldEndOffset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(-149.624, dos);
-		tb.addFieldEndOffset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(61.8894, dos);
-		tb.addFieldEndOffset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(-149.024, dos);
-		tb.addFieldEndOffset();
-
-		ISerializerDeserializer[] keyRecDescSers = {
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE };
-		RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
-
-		ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
-				spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
-				tb.getSize());
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				keyProviderOp, NC1_ID);
-
-		int[] keyFields = { 0, 1, 2, 3 };
-
-		RTreeSearchOperatorDescriptor primaryRTreeSearchOp = new RTreeSearchOperatorDescriptor(
-				spec, primaryRecDesc, storageManager,
-				treeIndexRegistryProvider, primaryRTreeSplitProvider,
-				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, keyFields,
-				opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryRTreeSearchOp, NC1_ID);
-
-		PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer,
-				NC1_ID);
-
-		spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0,
-				primaryRTreeSearchOp, 0);
-		spec.connect(new OneToOneConnectorDescriptor(spec),
-				primaryRTreeSearchOp, 0, printer, 0);
-
-		spec.addRoot(printer);
-		runTest(spec);
-	}
-
 	@AfterClass
 	public static void cleanup() throws Exception {
 		File primary = new File(primaryFileName);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreeSecondaryIndexOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreeSecondaryIndexSearchOperatorTest.java
similarity index 85%
rename from hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreeSecondaryIndexOperatorsTest.java
rename to hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreeSecondaryIndexSearchOperatorTest.java
index 07ead00..cc92e97 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreeSecondaryIndexOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/rtree/RTreeSecondaryIndexSearchOperatorTest.java
@@ -53,17 +53,18 @@
 import edu.uci.ics.hyracks.storage.am.btree.dataflow.BTreeSearchOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.ITreeIndexOpHelperFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexBulkLoadOperatorDescriptor;
-import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexStatsOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.common.tuples.TypeAwareTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.dataflow.RTreeOpHelperFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.dataflow.RTreeSearchOperatorDescriptor;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
@@ -71,7 +72,8 @@
 import edu.uci.ics.hyracks.test.support.TestTreeIndexRegistryProvider;
 import edu.uci.ics.hyracks.tests.integration.AbstractIntegrationTest;
 
-public class RTreeSecondaryIndexOperatorsTest extends AbstractIntegrationTest {
+public class RTreeSecondaryIndexSearchOperatorTest extends
+		AbstractIntegrationTest {
 	static {
 		TestStorageManagerComponentHolder.init(8192, 20, 20);
 	}
@@ -90,24 +92,15 @@
 	private int primaryKeyFieldCount = 4;
 	private ITypeTrait[] primaryTypeTraits = new ITypeTrait[primaryFieldCount];
 	private IBinaryComparatorFactory[] primaryComparatorFactories = new IBinaryComparatorFactory[primaryKeyFieldCount];
+	private IPrimitiveValueProviderFactory[] primaryValueProviderFactories = new IPrimitiveValueProviderFactory[primaryKeyFieldCount];
 
 	private RTreeTypeAwareTupleWriterFactory primaryTupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 			primaryTypeTraits);
 
-	private RecordDescriptor primaryRecDesc = new RecordDescriptor(
-			new ISerializerDeserializer[] {
-					DoubleSerializerDeserializer.INSTANCE,
-					DoubleSerializerDeserializer.INSTANCE,
-					DoubleSerializerDeserializer.INSTANCE,
-					DoubleSerializerDeserializer.INSTANCE,
-					UTF8StringSerializerDeserializer.INSTANCE });
-
 	private ITreeIndexFrameFactory primaryInteriorFrameFactory = new RTreeNSMInteriorFrameFactory(
-			primaryTupleWriterFactory, primaryRecDesc.getFields(),
-			primaryKeyFieldCount);
+			primaryTupleWriterFactory, primaryKeyFieldCount);
 	private ITreeIndexFrameFactory primaryLeafFrameFactory = new RTreeNSMLeafFrameFactory(
-			primaryTupleWriterFactory, primaryRecDesc.getFields(),
-			primaryKeyFieldCount);
+			primaryTupleWriterFactory, primaryKeyFieldCount);
 
 	private static String primaryRTreeName = "primary"
 			+ simpleDateFormat.format(new Date());
@@ -118,6 +111,14 @@
 			new FileSplit[] { new FileSplit(NC1_ID, new FileReference(new File(
 					primaryFileName))) });
 
+	private RecordDescriptor primaryRecDesc = new RecordDescriptor(
+			new ISerializerDeserializer[] {
+					DoubleSerializerDeserializer.INSTANCE,
+					DoubleSerializerDeserializer.INSTANCE,
+					DoubleSerializerDeserializer.INSTANCE,
+					DoubleSerializerDeserializer.INSTANCE,
+					UTF8StringSerializerDeserializer.INSTANCE });
+
 	// field, type and key declarations for primary B-tree index
 	private int primaryBTreeFieldCount = 10;
 	private ITypeTrait[] primaryBTreeTypeTraits = new ITypeTrait[primaryBTreeFieldCount];
@@ -157,23 +158,15 @@
 	private ITypeTrait[] secondaryTypeTraits = new ITypeTrait[secondaryFieldCount];
 	private int secondaryKeyFieldCount = 4;
 	private IBinaryComparatorFactory[] secondaryComparatorFactories = new IBinaryComparatorFactory[secondaryKeyFieldCount];
+	private IPrimitiveValueProviderFactory[] secondaryValueProviderFactories = new IPrimitiveValueProviderFactory[secondaryKeyFieldCount];
+
 	private RTreeTypeAwareTupleWriterFactory secondaryTupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 			secondaryTypeTraits);
 
-	private RecordDescriptor secondaryRecDesc = new RecordDescriptor(
-			new ISerializerDeserializer[] {
-					DoubleSerializerDeserializer.INSTANCE,
-					DoubleSerializerDeserializer.INSTANCE,
-					DoubleSerializerDeserializer.INSTANCE,
-					DoubleSerializerDeserializer.INSTANCE,
-					UTF8StringSerializerDeserializer.INSTANCE });
-
 	private ITreeIndexFrameFactory secondaryInteriorFrameFactory = new RTreeNSMInteriorFrameFactory(
-			secondaryTupleWriterFactory, secondaryRecDesc.getFields(),
-			secondaryKeyFieldCount);
+			secondaryTupleWriterFactory, secondaryKeyFieldCount);
 	private ITreeIndexFrameFactory secondaryLeafFrameFactory = new RTreeNSMLeafFrameFactory(
-			secondaryTupleWriterFactory, secondaryRecDesc.getFields(),
-			secondaryKeyFieldCount);
+			secondaryTupleWriterFactory, secondaryKeyFieldCount);
 
 	private static String secondaryRTreeName = "secondary"
 			+ simpleDateFormat.format(new Date());
@@ -184,6 +177,14 @@
 			new FileSplit[] { new FileSplit(NC1_ID, new FileReference(new File(
 					secondaryFileName))) });
 
+	private RecordDescriptor secondaryRecDesc = new RecordDescriptor(
+			new ISerializerDeserializer[] {
+					DoubleSerializerDeserializer.INSTANCE,
+					DoubleSerializerDeserializer.INSTANCE,
+					DoubleSerializerDeserializer.INSTANCE,
+					DoubleSerializerDeserializer.INSTANCE,
+					UTF8StringSerializerDeserializer.INSTANCE });
+
 	@Before
 	public void setup() throws Exception {
 		// field, type and key declarations for primary R-tree index
@@ -196,6 +197,10 @@
 		primaryComparatorFactories[1] = primaryComparatorFactories[0];
 		primaryComparatorFactories[2] = primaryComparatorFactories[0];
 		primaryComparatorFactories[3] = primaryComparatorFactories[0];
+		primaryValueProviderFactories[0] = DoublePrimitiveValueProviderFactory.INSTANCE;
+		primaryValueProviderFactories[1] = primaryValueProviderFactories[0];
+		primaryValueProviderFactories[2] = primaryValueProviderFactories[0];
+		primaryValueProviderFactories[3] = primaryValueProviderFactories[0];
 
 		// field, type and key declarations for primary B-tree index
 		primaryBTreeTypeTraits[0] = new TypeTrait(ITypeTrait.VARIABLE_LENGTH);
@@ -220,7 +225,11 @@
 		secondaryComparatorFactories[1] = secondaryComparatorFactories[0];
 		secondaryComparatorFactories[2] = secondaryComparatorFactories[0];
 		secondaryComparatorFactories[3] = secondaryComparatorFactories[0];
-		
+		secondaryValueProviderFactories[0] = DoublePrimitiveValueProviderFactory.INSTANCE;
+		secondaryValueProviderFactories[1] = secondaryValueProviderFactories[0];
+		secondaryValueProviderFactories[2] = secondaryValueProviderFactories[0];
+		secondaryValueProviderFactories[3] = secondaryValueProviderFactories[0];
+
 		loadPrimaryIndexTest();
 		loadPrimaryBTreeIndexTest();
 		loadSecondaryIndexTest();
@@ -283,7 +292,7 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryBTreeSplitProvider, primaryBTreeInteriorFrameFactory,
 				primaryBTreeLeafFrameFactory, primaryBTreeTypeTraits,
-				primaryBTreeComparatorFactories, fieldPermutation, 0.7f,
+				primaryBTreeComparatorFactories, null, fieldPermutation, 0.7f,
 				bTreeopHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryBTreeBulkLoad, NC1_ID);
@@ -329,8 +338,8 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				primaryRTreeSplitProvider, primaryInteriorFrameFactory,
 				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, fieldPermutation, 0.7f,
-				opHelperFactory);
+				primaryComparatorFactories, secondaryValueProviderFactories,
+				fieldPermutation, 0.7f, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				primaryRTreeBulkLoad, NC1_ID);
 
@@ -382,8 +391,8 @@
 				spec, storageManager, treeIndexRegistryProvider,
 				secondaryRTreeSplitProvider, secondaryInteriorFrameFactory,
 				secondaryLeafFrameFactory, secondaryTypeTraits,
-				secondaryComparatorFactories, fieldPermutation, 0.7f,
-				opHelperFactory);
+				secondaryComparatorFactories, secondaryValueProviderFactories,
+				fieldPermutation, 0.7f, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				secondaryRTreeBulkLoad, NC1_ID);
 
@@ -397,77 +406,6 @@
 	}
 
 	@Test
-	public void showPrimaryIndexStats() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		TreeIndexStatsOperatorDescriptor primaryStatsOp = new TreeIndexStatsOperatorDescriptor(
-				spec, storageManager, treeIndexRegistryProvider,
-				primaryRTreeSplitProvider, primaryInteriorFrameFactory,
-				primaryLeafFrameFactory, primaryTypeTraits,
-				primaryComparatorFactories, opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryStatsOp, NC1_ID);
-
-		spec.addRoot(primaryStatsOp);
-		runTest(spec);
-	}
-
-	@Test
-	public void searchPrimaryIndexTest() throws Exception {
-		JobSpecification spec = new JobSpecification();
-
-		// build tuple
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount);
-		DataOutput dos = tb.getDataOutput();
-
-		tb.reset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(61.2894, dos);
-		tb.addFieldEndOffset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(-149.624, dos);
-		tb.addFieldEndOffset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(61.8894, dos);
-		tb.addFieldEndOffset();
-		DoubleSerializerDeserializer.INSTANCE.serialize(-149.024, dos);
-		tb.addFieldEndOffset();
-
-		ISerializerDeserializer[] keyRecDescSers = {
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE };
-		RecordDescriptor keyRecDesc = new RecordDescriptor(keyRecDescSers);
-
-		ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(
-				spec, keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(),
-				tb.getSize());
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				keyProviderOp, NC1_ID);
-
-		int[] keyFields = { 0, 1, 2, 3 };
-
-		RTreeSearchOperatorDescriptor primaryRTreeSearchOp = new RTreeSearchOperatorDescriptor(
-				spec, primaryRecDesc, storageManager,
-				treeIndexRegistryProvider, primaryRTreeSplitProvider,
-				primaryInteriorFrameFactory, primaryLeafFrameFactory,
-				primaryTypeTraits, primaryComparatorFactories, keyFields,
-				opHelperFactory);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
-				primaryRTreeSearchOp, NC1_ID);
-
-		PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer,
-				NC1_ID);
-
-		spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0,
-				primaryRTreeSearchOp, 0);
-		spec.connect(new OneToOneConnectorDescriptor(spec),
-				primaryRTreeSearchOp, 0, printer, 0);
-
-		spec.addRoot(printer);
-		runTest(spec);
-	}
-
-	@Test
 	public void searchSecondaryIndexTest() throws Exception {
 		JobSpecification spec = new JobSpecification();
 
@@ -504,8 +442,8 @@
 				spec, secondaryRecDesc, storageManager,
 				treeIndexRegistryProvider, secondaryRTreeSplitProvider,
 				secondaryInteriorFrameFactory, secondaryLeafFrameFactory,
-				secondaryTypeTraits, secondaryComparatorFactories, keyFields,
-				opHelperFactory);
+				secondaryTypeTraits, secondaryComparatorFactories,
+				secondaryValueProviderFactories, keyFields, opHelperFactory);
 		PartitionConstraintHelper.addAbsoluteLocationConstraint(spec,
 				secondaryRTreeSearchOp, NC1_ID);
 
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java
index 9b8d4a2..eaf5a81 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java
@@ -1,6 +1,7 @@
 package edu.uci.ics.hyracks.storage.am.btree.dataflow;
 
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.storage.am.btree.impls.BTree;
 import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
@@ -11,13 +12,17 @@
 import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexOpHelper;
 import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.freepage.LinkedListFreePageManager;
+import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 
 public class BTreeOpHelper extends TreeIndexOpHelper {
 
+    protected ITreeIndexOperatorDescriptorHelper opDesc;
+
     public BTreeOpHelper(ITreeIndexOperatorDescriptorHelper opDesc, IHyracksTaskContext ctx, int partition,
             IndexHelperOpenMode mode) {
         super(opDesc, ctx, partition, mode);
+        this.opDesc = opDesc;
     }
 
     public ITreeIndex createTreeIndex() throws HyracksDataException {
@@ -29,4 +34,7 @@
                 opDesc.getTreeIndexLeafFactory(), cmp);
     }
 
+    public MultiComparator createMultiComparator(IBinaryComparator[] comparators) throws HyracksDataException {
+        return new MultiComparator(opDesc.getTreeIndexTypeTraits(), comparators);
+    }
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java
index 717c99e..c542bb0 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java
@@ -49,7 +49,7 @@
             IBinaryComparatorFactory[] comparatorFactories, boolean isForward, int[] lowKeyFields, int[] highKeyFields,
             boolean lowKeyInclusive, boolean highKeyInclusive, ITreeIndexOpHelperFactory opHelperFactory) {
         super(spec, 1, 1, recDesc, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
+                leafFrameFactory, typeTraits, comparatorFactories, null, opHelperFactory);
         this.isForward = isForward;
         this.lowKeyFields = lowKeyFields;
         this.highKeyFields = highKeyFields;
@@ -58,9 +58,9 @@
     }
 
     @Override
-    public IOperatorNodePushable createPushRuntime(final IHyracksTaskContext ctx, IOperatorEnvironment env,
+    public IOperatorNodePushable createPushRuntime(final IHyracksTaskContext ctx, final IOperatorEnvironment env,
             IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
         return new BTreeSearchOperatorNodePushable(this, ctx, partition, recordDescProvider, isForward, lowKeyFields,
                 highKeyFields, lowKeyInclusive, highKeyInclusive);
     }
-}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
index 2831ff6..1869a1b 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
@@ -1151,7 +1151,7 @@
             ITreeIndexFrame interiorFrame, ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
 
         if (loaded)
-            throw new HyracksDataException("Trying to bulk-load BTree but has BTree already been loaded.");
+            throw new HyracksDataException("Trying to bulk-load BTree but BTree has already been loaded.");
 
         BulkLoadContext ctx = new BulkLoadContext(fillFactor, (IBTreeLeafFrame) leafFrame,
                 (IBTreeInteriorFrame) interiorFrame, metaFrame);
@@ -1287,4 +1287,4 @@
     public IndexType getIndexType() {
         return IndexType.BTREE;
     }
-}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ICursorInitialState.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ICursorInitialState.java
index 5f7c88d..7c80be1 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ICursorInitialState.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ICursorInitialState.java
@@ -18,7 +18,7 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public interface ICursorInitialState {
-    public ICachedPage getPage();
+	public ICachedPage getPage();
 
-    public void setPage(ICachedPage page);
+	public void setPage(ICachedPage page);
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java
index 7abc0e3..045ff9d 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java
@@ -3,23 +3,27 @@
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public interface IFreePageManager {
-    public int getFreePage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException;
+	public int getFreePage(ITreeIndexMetaDataFrame metaFrame)
+			throws HyracksDataException;
 
-    public void addFreePage(ITreeIndexMetaDataFrame metaFrame, int freePage) throws HyracksDataException;
+	public void addFreePage(ITreeIndexMetaDataFrame metaFrame, int freePage)
+			throws HyracksDataException;
 
-    public int getMaxPage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException;
+	public int getMaxPage(ITreeIndexMetaDataFrame metaFrame)
+			throws HyracksDataException;
 
-    public void init(ITreeIndexMetaDataFrame metaFrame, int currentMaxPage) throws HyracksDataException;
+	public void init(ITreeIndexMetaDataFrame metaFrame, int currentMaxPage)
+			throws HyracksDataException;
 
-    public ITreeIndexMetaDataFrameFactory getMetaDataFrameFactory();
+	public ITreeIndexMetaDataFrameFactory getMetaDataFrameFactory();
 
-    // required to return negative values
-    public byte getMetaPageLevelIndicator();
+	// required to return negative values
+	public byte getMetaPageLevelIndicator();
 
-    public byte getFreePageLevelIndicator();
+	public byte getFreePageLevelIndicator();
 
-    // determined by examining level indicator
-    public boolean isMetaPage(ITreeIndexMetaDataFrame metaFrame);
+	// determined by examining level indicator
+	public boolean isMetaPage(ITreeIndexMetaDataFrame metaFrame);
 
-    public boolean isFreePage(ITreeIndexMetaDataFrame metaFrame);
+	public boolean isFreePage(ITreeIndexMetaDataFrame metaFrame);
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IPrimitiveValueProvider.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IPrimitiveValueProvider.java
new file mode 100644
index 0000000..4696e68
--- /dev/null
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IPrimitiveValueProvider.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.uci.ics.hyracks.storage.am.common.api;
+
+public interface IPrimitiveValueProvider {
+	public double getValue(byte[] bytes, int offset);
+}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IPrimitiveValueProviderFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IPrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..8e45d0c
--- /dev/null
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IPrimitiveValueProviderFactory.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.uci.ics.hyracks.storage.am.common.api;
+
+import java.io.Serializable;
+
+public interface IPrimitiveValueProviderFactory extends Serializable {
+	public IPrimitiveValueProvider createPrimitiveValueProvider();
+}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISearchPredicate.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISearchPredicate.java
index f4836e0..a96db28 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISearchPredicate.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISearchPredicate.java
@@ -20,7 +20,7 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 
 public interface ISearchPredicate extends Serializable {
-    public MultiComparator getLowKeyComparator();
+	public MultiComparator getLowKeyComparator();
 
-    public MultiComparator getHighKeyComparator();
+	public MultiComparator getHighKeyComparator();
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISlotManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISlotManager.java
index 29646e7..a6102ab 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISlotManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISlotManager.java
@@ -21,22 +21,23 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 
 public interface ISlotManager {
-    public void setFrame(ITreeIndexFrame frame);
+	public void setFrame(ITreeIndexFrame frame);
 
-    public int findTupleIndex(ITupleReference searchKey, ITreeIndexTupleReference frameTuple, MultiComparator multiCmp,
-            FindTupleMode mode, FindTupleNoExactMatchPolicy matchPolicy);
+	public int findTupleIndex(ITupleReference searchKey,
+			ITreeIndexTupleReference frameTuple, MultiComparator multiCmp,
+			FindTupleMode mode, FindTupleNoExactMatchPolicy matchPolicy);
 
-    public int insertSlot(int tupleIndex, int tupleOff);
+	public int insertSlot(int tupleIndex, int tupleOff);
 
-    public int getSlotStartOff();
+	public int getSlotStartOff();
 
-    public int getSlotEndOff();
+	public int getSlotEndOff();
 
-    public int getTupleOff(int slotOff);
+	public int getTupleOff(int slotOff);
 
-    public void setSlot(int slotOff, int value);
+	public void setSlot(int slotOff, int value);
 
-    public int getSlotOff(int tupleIndex);
+	public int getSlotOff(int tupleIndex);
 
-    public int getSlotSize();
+	public int getSlotSize();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISplitKey.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISplitKey.java
index 246c09d..3a1c8a1 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISplitKey.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ISplitKey.java
@@ -3,23 +3,23 @@
 import java.nio.ByteBuffer;
 
 public interface ISplitKey {
-    public void initData(int keySize);
+	public void initData(int keySize);
 
-    public void reset();
+	public void reset();
 
-    public ByteBuffer getBuffer();
+	public ByteBuffer getBuffer();
 
-    public ITreeIndexTupleReference getTuple();
+	public ITreeIndexTupleReference getTuple();
 
-    public int getLeftPage();
+	public int getLeftPage();
 
-    public int getRightPage();
+	public int getRightPage();
 
-    public void setLeftPage(int leftPage);
+	public void setLeftPage(int leftPage);
 
-    public void setRightPage(int rightPage);
+	public void setRightPage(int rightPage);
 
-    public void setPages(int leftPage, int rightPage);
+	public void setPages(int leftPage, int rightPage);
 
-    public ISplitKey duplicate(ITreeIndexTupleReference copyTuple);
+	public ISplitKey duplicate(ITreeIndexTupleReference copyTuple);
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java
index 2d77f06..d075285 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java
@@ -6,47 +6,56 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOpContext;
 
 public interface ITreeIndex {
-    // init:
+	// init:
 
-    public void create(int indexFileId, ITreeIndexFrame leafFrame, ITreeIndexMetaDataFrame metaFrame) throws Exception;
+	public void create(int indexFileId, ITreeIndexFrame leafFrame,
+			ITreeIndexMetaDataFrame metaFrame) throws Exception;
 
-    public void open(int indexFileId);
+	public void open(int indexFileId);
 
-    // operations:
+	// operations:
 
-    public void insert(ITupleReference tuple, IndexOpContext ictx) throws Exception;
+	public void insert(ITupleReference tuple, IndexOpContext ictx)
+			throws Exception;
 
-    public void update(ITupleReference tuple, IndexOpContext ictx) throws Exception;
+	public void update(ITupleReference tuple, IndexOpContext ictx)
+			throws Exception;
 
-    public void delete(ITupleReference tuple, IndexOpContext ictx) throws Exception;
+	public void delete(ITupleReference tuple, IndexOpContext ictx)
+			throws Exception;
 
-    public IndexOpContext createOpContext(IndexOp op, ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
-            ITreeIndexMetaDataFrame metaFrame);
+	public IndexOpContext createOpContext(IndexOp op,
+			ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
+			ITreeIndexMetaDataFrame metaFrame);
 
-    // bulk loading:
+	// bulk loading:
 
-    public IIndexBulkLoadContext beginBulkLoad(float fillFactor, ITreeIndexFrame leafFrame,
-            ITreeIndexFrame interiorFrame, ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException;
+	public IIndexBulkLoadContext beginBulkLoad(float fillFactor,
+			ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
+			ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException;
 
-    public void bulkLoadAddTuple(IIndexBulkLoadContext ictx, ITupleReference tuple) throws HyracksDataException;
+	public void bulkLoadAddTuple(IIndexBulkLoadContext ictx,
+			ITupleReference tuple) throws HyracksDataException;
 
-    public void endBulkLoad(IIndexBulkLoadContext ictx) throws HyracksDataException;
+	public void endBulkLoad(IIndexBulkLoadContext ictx)
+			throws HyracksDataException;
 
-    // search:
-    public void diskOrderScan(ITreeIndexCursor icursor, ITreeIndexFrame leafFrame, ITreeIndexMetaDataFrame metaFrame,
-            IndexOpContext ictx) throws HyracksDataException;
+	// search:
+	public void diskOrderScan(ITreeIndexCursor icursor,
+			ITreeIndexFrame leafFrame, ITreeIndexMetaDataFrame metaFrame,
+			IndexOpContext ictx) throws HyracksDataException;
 
-    // utility:
+	// utility:
 
-    public IFreePageManager getFreePageManager();
+	public IFreePageManager getFreePageManager();
 
-    public int getRootPageId();
+	public int getRootPageId();
 
-    public ITreeIndexFrameFactory getLeafFrameFactory();
+	public ITreeIndexFrameFactory getLeafFrameFactory();
 
-    public ITreeIndexFrameFactory getInteriorFrameFactory();
+	public ITreeIndexFrameFactory getInteriorFrameFactory();
 
-    public int getFieldCount();
+	public int getFieldCount();
 
-    public IndexType getIndexType();
+	public IndexType getIndexType();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexCursor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexCursor.java
index 22b2b6f..56dfd47 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexCursor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexCursor.java
@@ -20,21 +20,22 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public interface ITreeIndexCursor {
-    public void reset();
+	public void reset();
 
-    public boolean hasNext() throws Exception;
+	public boolean hasNext() throws Exception;
 
-    public void next() throws Exception;
+	public void next() throws Exception;
 
-    public void open(ICursorInitialState initialState, ISearchPredicate searchPred) throws Exception;
+	public void open(ICursorInitialState initialState,
+			ISearchPredicate searchPred) throws Exception;
 
-    public ICachedPage getPage();
+	public ICachedPage getPage();
 
-    public void close() throws Exception;
+	public void close() throws Exception;
 
-    public void setBufferCache(IBufferCache bufferCache);
+	public void setBufferCache(IBufferCache bufferCache);
 
-    public void setFileId(int fileId);
+	public void setFileId(int fileId);
 
-    public ITupleReference getTuple();
+	public ITupleReference getTuple();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrame.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrame.java
index 246efe4..db458ec 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrame.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrame.java
@@ -25,80 +25,86 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public interface ITreeIndexFrame {
-    public void setPage(ICachedPage page);
+	public void setPage(ICachedPage page);
 
-    public ICachedPage getPage();
+	public ICachedPage getPage();
 
-    public ByteBuffer getBuffer();
+	public ByteBuffer getBuffer();
 
-    public int findTupleIndex(ITupleReference tuple, MultiComparator cmp) throws Exception;
+	public int findTupleIndex(ITupleReference tuple, MultiComparator cmp)
+			throws Exception;
 
-    public void insert(ITupleReference tuple, MultiComparator cmp, int tupleIndex) throws Exception;
+	public void insert(ITupleReference tuple, MultiComparator cmp,
+			int tupleIndex) throws Exception;
 
-    public void update(int rid, ITupleReference tuple) throws Exception;
+	public void update(int rid, ITupleReference tuple) throws Exception;
 
-    public void delete(ITupleReference tuple, MultiComparator cmp, boolean exactDelete) throws Exception;
+	public void delete(ITupleReference tuple, MultiComparator cmp,
+			boolean exactDelete) throws Exception;
 
-    // returns true if slots were modified, false otherwise
-    public boolean compact(MultiComparator cmp);
+	// returns true if slots were modified, false otherwise
+	public boolean compact(MultiComparator cmp);
 
-    public boolean compress(MultiComparator cmp) throws HyracksDataException;
+	public boolean compress(MultiComparator cmp) throws HyracksDataException;
 
-    public void initBuffer(byte level);
+	public void initBuffer(byte level);
 
-    public int getTupleCount();
+	public int getTupleCount();
 
-    // assumption: page must be write-latched at this point
-    public FrameOpSpaceStatus hasSpaceInsert(ITupleReference tuple, MultiComparator cmp);
+	// assumption: page must be write-latched at this point
+	public FrameOpSpaceStatus hasSpaceInsert(ITupleReference tuple,
+			MultiComparator cmp);
 
-    public FrameOpSpaceStatus hasSpaceUpdate(int rid, ITupleReference tuple, MultiComparator cmp);
+	public FrameOpSpaceStatus hasSpaceUpdate(int rid, ITupleReference tuple,
+			MultiComparator cmp);
 
-    public int getTupleOffset(int slotNum);
+	public int getTupleOffset(int slotNum);
 
-    public int getTotalFreeSpace();
+	public int getTotalFreeSpace();
 
-    public void setPageLsn(int pageLsn);
+	public void setPageLsn(int pageLsn);
 
-    public int getPageLsn();
+	public int getPageLsn();
 
-    // for debugging
-    public void printHeader();
+	// for debugging
+	public void printHeader();
 
-    public String printKeys(MultiComparator cmp, ISerializerDeserializer[] fields) throws HyracksDataException;
+	public String printKeys(MultiComparator cmp,
+			ISerializerDeserializer[] fields) throws HyracksDataException;
 
-    // TODO; what if tuples more than half-page size?
-    public int split(ITreeIndexFrame rightFrame, ITupleReference tuple, MultiComparator cmp, ISplitKey splitKey)
-            throws Exception;
+	// TODO; what if tuples more than half-page size?
+	public int split(ITreeIndexFrame rightFrame, ITupleReference tuple,
+			MultiComparator cmp, ISplitKey splitKey) throws Exception;
 
-    public ISlotManager getSlotManager();
+	public ISlotManager getSlotManager();
 
-    // ATTENTION: in b-tree operations it may not always be possible to
-    // determine whether an ICachedPage is a leaf or interior node
-    // a compatible interior and leaf implementation MUST return identical
-    // values when given the same ByteBuffer for the functions below
-    public boolean isLeaf();
+	// ATTENTION: in b-tree operations it may not always be possible to
+	// determine whether an ICachedPage is a leaf or interior node
+	// a compatible interior and leaf implementation MUST return identical
+	// values when given the same ByteBuffer for the functions below
+	public boolean isLeaf();
 
-    public boolean isInterior();
+	public boolean isInterior();
 
-    public byte getLevel();
+	public byte getLevel();
 
-    public void setLevel(byte level);
+	public void setLevel(byte level);
 
-    public boolean getSmFlag(); // structure modification flag
+	public boolean getSmFlag(); // structure modification flag
 
-    public void setSmFlag(boolean smFlag);
+	public void setSmFlag(boolean smFlag);
 
-    public int getSlotSize();
+	public int getSlotSize();
 
-    // TODO: should be removed after new tuple format
-    public void setPageTupleFieldCount(int fieldCount);
+	// TODO: should be removed after new tuple format
+	public void setPageTupleFieldCount(int fieldCount);
 
-    // for debugging
-    public int getFreeSpaceOff();
+	// for debugging
+	public int getFreeSpaceOff();
 
-    public void setFreeSpaceOff(int freeSpace);
+	public void setFreeSpaceOff(int freeSpace);
 
-    public ITreeIndexTupleWriter getTupleWriter();
+	public ITreeIndexTupleWriter getTupleWriter();
 
-    public int getPageHeaderSize();
+	public int getPageHeaderSize();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrameFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrameFactory.java
index 83b95b6..9ec69d9 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrameFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexFrameFactory.java
@@ -3,5 +3,5 @@
 import java.io.Serializable;
 
 public interface ITreeIndexFrameFactory extends Serializable {
-    public ITreeIndexFrame createFrame();
+	public ITreeIndexFrame createFrame();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrame.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrame.java
index bbd03d6..4d81e5e6 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrame.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrame.java
@@ -18,27 +18,27 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public interface ITreeIndexMetaDataFrame {
-    public void initBuffer(int level);
+	public void initBuffer(int level);
 
-    public void setPage(ICachedPage page);
+	public void setPage(ICachedPage page);
 
-    public ICachedPage getPage();
+	public ICachedPage getPage();
 
-    public byte getLevel();
+	public byte getLevel();
 
-    public void setLevel(byte level);
+	public void setLevel(byte level);
 
-    public int getNextPage();
+	public int getNextPage();
 
-    public void setNextPage(int nextPage);
+	public void setNextPage(int nextPage);
 
-    public int getMaxPage();
+	public int getMaxPage();
 
-    public void setMaxPage(int maxPage);
+	public void setMaxPage(int maxPage);
 
-    public int getFreePage();
+	public int getFreePage();
 
-    public boolean hasSpace();
+	public boolean hasSpace();
 
-    public void addFreePage(int freePage);
+	public void addFreePage(int freePage);
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrameFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrameFactory.java
index 6fd88e8..d5625b4 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrameFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexMetaDataFrameFactory.java
@@ -16,5 +16,5 @@
 package edu.uci.ics.hyracks.storage.am.common.api;
 
 public interface ITreeIndexMetaDataFrameFactory {
-    public ITreeIndexMetaDataFrame createFrame();
+	public ITreeIndexMetaDataFrame createFrame();
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleReference.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleReference.java
index d2c2df4..8b845ac 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleReference.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleReference.java
@@ -20,11 +20,11 @@
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
 
 public interface ITreeIndexTupleReference extends ITupleReference {
-    public void setFieldCount(int fieldCount);
+	public void setFieldCount(int fieldCount);
 
-    public void setFieldCount(int fieldStartIndex, int fieldCount);
+	public void setFieldCount(int fieldStartIndex, int fieldCount);
 
-    public void resetByTupleOffset(ByteBuffer buf, int tupleStartOffset);
+	public void resetByTupleOffset(ByteBuffer buf, int tupleStartOffset);
 
-    public void resetByTupleIndex(ITreeIndexFrame frame, int tupleIndex);
+	public void resetByTupleIndex(ITreeIndexFrame frame, int tupleIndex);
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriter.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriter.java
index 39577ea..6cd12fb 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriter.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriter.java
@@ -20,18 +20,20 @@
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
 
 public interface ITreeIndexTupleWriter {
-    public int writeTuple(ITupleReference tuple, ByteBuffer targetBuf, int targetOff);
+	public int writeTuple(ITupleReference tuple, ByteBuffer targetBuf,
+			int targetOff);
 
-    public int bytesRequired(ITupleReference tuple);
+	public int bytesRequired(ITupleReference tuple);
 
-    public int writeTupleFields(ITupleReference tuple, int startField, int numFields, ByteBuffer targetBuf,
-            int targetOff);
+	public int writeTupleFields(ITupleReference tuple, int startField,
+			int numFields, ByteBuffer targetBuf, int targetOff);
 
-    public int bytesRequired(ITupleReference tuple, int startField, int numFields);
+	public int bytesRequired(ITupleReference tuple, int startField,
+			int numFields);
 
-    // return a tuplereference instance that can read the tuple written by this
-    // writer
-    // the main idea is that the format of the written tuple may not be the same
-    // as the format written by this writer
-    public ITreeIndexTupleReference createTupleReference();
+	// return a tuplereference instance that can read the tuple written by this
+	// writer
+	// the main idea is that the format of the written tuple may not be the same
+	// as the format written by this writer
+	public ITreeIndexTupleReference createTupleReference();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriterFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriterFactory.java
index bd7bfda..ea5e740 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriterFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexTupleWriterFactory.java
@@ -18,5 +18,5 @@
 import java.io.Serializable;
 
 public interface ITreeIndexTupleWriterFactory extends Serializable {
-    public ITreeIndexTupleWriter createTupleWriter();
+	public ITreeIndexTupleWriter createTupleWriter();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java
index d5f9f44..6f83e0b 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java
@@ -1,5 +1,5 @@
 package edu.uci.ics.hyracks.storage.am.common.api;
 
 public enum IndexType {
-    BTREE, RTREE, INVERTED
+	BTREE, RTREE, INVERTED
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/TreeIndexException.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/TreeIndexException.java
index ad3db58..48acb06 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/TreeIndexException.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/TreeIndexException.java
@@ -17,22 +17,22 @@
 
 public class TreeIndexException extends Exception {
 
-    private static final long serialVersionUID = 1L;
-    private boolean handled = false;
+	private static final long serialVersionUID = 1L;
+	private boolean handled = false;
 
-    public TreeIndexException(Exception e) {
-        super(e);
-    }
+	public TreeIndexException(Exception e) {
+		super(e);
+	}
 
-    public TreeIndexException(String message) {
-        super(message);
-    }
+	public TreeIndexException(String message) {
+		super(message);
+	}
 
-    public void setHandled(boolean handled) {
-        this.handled = handled;
-    }
+	public void setHandled(boolean handled) {
+		this.handled = handled;
+	}
 
-    public boolean getHandled() {
-        return handled;
-    }
+	public boolean getHandled() {
+		return handled;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java
index c905eb2..d7c7ab9 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java
@@ -21,90 +21,103 @@
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public abstract class AbstractTreeIndexOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor implements
-        ITreeIndexOperatorDescriptorHelper {
+public abstract class AbstractTreeIndexOperatorDescriptor extends
+		AbstractSingleActivityOperatorDescriptor implements
+		ITreeIndexOperatorDescriptorHelper {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    protected final IFileSplitProvider fileSplitProvider;
+	protected final IFileSplitProvider fileSplitProvider;
 
-    protected final IBinaryComparatorFactory[] comparatorFactories;
+	protected final IBinaryComparatorFactory[] comparatorFactories;
+	protected final IPrimitiveValueProviderFactory[] valueProviderFactories;
 
-    protected final ITreeIndexFrameFactory interiorFrameFactory;
-    protected final ITreeIndexFrameFactory leafFrameFactory;
+	protected final ITreeIndexFrameFactory interiorFrameFactory;
+	protected final ITreeIndexFrameFactory leafFrameFactory;
 
-    protected final IStorageManagerInterface storageManager;
-    protected final IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider;
+	protected final IStorageManagerInterface storageManager;
+	protected final IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider;
 
-    protected final ITypeTrait[] typeTraits;
+	protected final ITypeTrait[] typeTraits;
 
-    protected final ITreeIndexOpHelperFactory opHelperFactory;
+	protected final ITreeIndexOpHelperFactory opHelperFactory;
 
-    public AbstractTreeIndexOperatorDescriptor(JobSpecification spec, int inputArity, int outputArity,
-            RecordDescriptor recDesc, IStorageManagerInterface storageManager,
-            IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider, IFileSplitProvider fileSplitProvider,
-            ITreeIndexFrameFactory interiorFrameFactory, ITreeIndexFrameFactory leafFrameFactory,
-            ITypeTrait[] typeTraits, IBinaryComparatorFactory[] comparatorFactories,
-            ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, inputArity, outputArity);
-        this.fileSplitProvider = fileSplitProvider;
-        this.storageManager = storageManager;
-        this.treeIndexRegistryProvider = treeIndexRegistryProvider;
-        this.interiorFrameFactory = interiorFrameFactory;
-        this.leafFrameFactory = leafFrameFactory;
-        this.typeTraits = typeTraits;
-        this.comparatorFactories = comparatorFactories;
-        this.opHelperFactory = opHelperFactory;
-        if (outputArity > 0)
-            recordDescriptors[0] = recDesc;
-    }
+	public AbstractTreeIndexOperatorDescriptor(JobSpecification spec,
+			int inputArity, int outputArity, RecordDescriptor recDesc,
+			IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			IBinaryComparatorFactory[] comparatorFactories,
+			IPrimitiveValueProviderFactory[] valueProviderFactories,
+			ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, inputArity, outputArity);
+		this.fileSplitProvider = fileSplitProvider;
+		this.storageManager = storageManager;
+		this.treeIndexRegistryProvider = treeIndexRegistryProvider;
+		this.interiorFrameFactory = interiorFrameFactory;
+		this.leafFrameFactory = leafFrameFactory;
+		this.typeTraits = typeTraits;
+		this.comparatorFactories = comparatorFactories;
+		this.valueProviderFactories = valueProviderFactories;
+		this.opHelperFactory = opHelperFactory;
+		if (outputArity > 0)
+			recordDescriptors[0] = recDesc;
+	}
 
-    @Override
-    public IFileSplitProvider getTreeIndexFileSplitProvider() {
-        return fileSplitProvider;
-    }
+	@Override
+	public IFileSplitProvider getTreeIndexFileSplitProvider() {
+		return fileSplitProvider;
+	}
 
-    @Override
-    public IBinaryComparatorFactory[] getTreeIndexComparatorFactories() {
-        return comparatorFactories;
-    }
+	@Override
+	public IBinaryComparatorFactory[] getTreeIndexComparatorFactories() {
+		return comparatorFactories;
+	}
 
-    @Override
-    public ITypeTrait[] getTreeIndexTypeTraits() {
-        return typeTraits;
-    }
+	@Override
+	public ITypeTrait[] getTreeIndexTypeTraits() {
+		return typeTraits;
+	}
 
-    @Override
-    public ITreeIndexFrameFactory getTreeIndexInteriorFactory() {
-        return interiorFrameFactory;
-    }
+	@Override
+	public IPrimitiveValueProviderFactory[] getTreeIndexValueProviderFactories() {
+		return valueProviderFactories;
+	}
 
-    @Override
-    public ITreeIndexFrameFactory getTreeIndexLeafFactory() {
-        return leafFrameFactory;
-    }
+	@Override
+	public ITreeIndexFrameFactory getTreeIndexInteriorFactory() {
+		return interiorFrameFactory;
+	}
 
-    @Override
-    public IStorageManagerInterface getStorageManager() {
-        return storageManager;
-    }
+	@Override
+	public ITreeIndexFrameFactory getTreeIndexLeafFactory() {
+		return leafFrameFactory;
+	}
 
-    @Override
-    public IIndexRegistryProvider<ITreeIndex> getTreeIndexRegistryProvider() {
-        return treeIndexRegistryProvider;
-    }
+	@Override
+	public IStorageManagerInterface getStorageManager() {
+		return storageManager;
+	}
 
-    @Override
-    public RecordDescriptor getRecordDescriptor() {
-        return recordDescriptors[0];
-    }
+	@Override
+	public IIndexRegistryProvider<ITreeIndex> getTreeIndexRegistryProvider() {
+		return treeIndexRegistryProvider;
+	}
 
-    @Override
-    public ITreeIndexOpHelperFactory getTreeIndexOpHelperFactory() {
-        return opHelperFactory;
-    }
-}
+	@Override
+	public RecordDescriptor getRecordDescriptor() {
+		return recordDescriptors[0];
+	}
+
+	@Override
+	public ITreeIndexOpHelperFactory getTreeIndexOpHelperFactory() {
+		return opHelperFactory;
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexRegistryProvider.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexRegistryProvider.java
index 7971a62..ed20de0 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexRegistryProvider.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexRegistryProvider.java
@@ -20,5 +20,5 @@
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
 
 public interface IIndexRegistryProvider<IndexType> extends Serializable {
-    public IndexRegistry<IndexType> getRegistry(IHyracksTaskContext ctx);
+	public IndexRegistry<IndexType> getRegistry(IHyracksTaskContext ctx);
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOpHelperFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOpHelperFactory.java
index cb4d92d..1f734f4 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOpHelperFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOpHelperFactory.java
@@ -5,6 +5,8 @@
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
 
 public interface ITreeIndexOpHelperFactory extends Serializable {
-    public TreeIndexOpHelper createTreeIndexOpHelper(ITreeIndexOperatorDescriptorHelper opDesc,
-            final IHyracksTaskContext ctx, int partition, IndexHelperOpenMode mode);
+	public TreeIndexOpHelper createTreeIndexOpHelper(
+			ITreeIndexOperatorDescriptorHelper opDesc,
+			final IHyracksTaskContext ctx, int partition,
+			IndexHelperOpenMode mode);
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOperatorDescriptorHelper.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOperatorDescriptorHelper.java
index 9098a78..79ecb37 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOperatorDescriptorHelper.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/ITreeIndexOperatorDescriptorHelper.java
@@ -5,26 +5,29 @@
 import edu.uci.ics.hyracks.api.dataflow.value.ITypeTrait;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
 public interface ITreeIndexOperatorDescriptorHelper extends IActivity {
-    public IFileSplitProvider getTreeIndexFileSplitProvider();
+	public IFileSplitProvider getTreeIndexFileSplitProvider();
 
-    public IBinaryComparatorFactory[] getTreeIndexComparatorFactories();
+	public IBinaryComparatorFactory[] getTreeIndexComparatorFactories();
 
-    public ITypeTrait[] getTreeIndexTypeTraits();
+	public IPrimitiveValueProviderFactory[] getTreeIndexValueProviderFactories();
 
-    public ITreeIndexFrameFactory getTreeIndexInteriorFactory();
+	public ITypeTrait[] getTreeIndexTypeTraits();
 
-    public ITreeIndexFrameFactory getTreeIndexLeafFactory();
+	public ITreeIndexFrameFactory getTreeIndexInteriorFactory();
 
-    public IStorageManagerInterface getStorageManager();
+	public ITreeIndexFrameFactory getTreeIndexLeafFactory();
 
-    public IIndexRegistryProvider<ITreeIndex> getTreeIndexRegistryProvider();
+	public IStorageManagerInterface getStorageManager();
 
-    public RecordDescriptor getRecordDescriptor();
+	public IIndexRegistryProvider<ITreeIndex> getTreeIndexRegistryProvider();
 
-    public ITreeIndexOpHelperFactory getTreeIndexOpHelperFactory();
-}
+	public RecordDescriptor getRecordDescriptor();
+
+	public ITreeIndexOpHelperFactory getTreeIndexOpHelperFactory();
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexHelperOpenMode.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexHelperOpenMode.java
index aa41184..0b27a0e 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexHelperOpenMode.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexHelperOpenMode.java
@@ -1,5 +1,5 @@
 package edu.uci.ics.hyracks.storage.am.common.dataflow;
 
 public enum IndexHelperOpenMode {
-    OPEN, CREATE, ENLIST
+	OPEN, CREATE, ENLIST
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexRegistry.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexRegistry.java
index de00d5a..df372f4c 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexRegistry.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexRegistry.java
@@ -21,33 +21,33 @@
 
 public class IndexRegistry<IndexType> {
 
-    private HashMap<Integer, IndexType> map = new HashMap<Integer, IndexType>();
-    private Lock registryLock = new ReentrantLock();
+	private HashMap<Integer, IndexType> map = new HashMap<Integer, IndexType>();
+	private Lock registryLock = new ReentrantLock();
 
-    public IndexType get(int fileId) {
-        return map.get(fileId);
-    }
+	public IndexType get(int fileId) {
+		return map.get(fileId);
+	}
 
-    public void lock() {
-        registryLock.lock();
-    }
+	public void lock() {
+		registryLock.lock();
+	}
 
-    public void unlock() {
-        registryLock.unlock();
-    }
+	public void unlock() {
+		registryLock.unlock();
+	}
 
-    public void register(int fileId, IndexType index) {
-        map.put(fileId, index);
-    }
+	public void register(int fileId, IndexType index) {
+		map.put(fileId, index);
+	}
 
-    public void unregister(int fileId) {
-        try {
-            map.remove(fileId);
-        } catch (Exception e) {
-        }
-    }
+	public void unregister(int fileId) {
+		try {
+			map.remove(fileId);
+		} catch (Exception e) {
+		}
+	}
 
-    public int size() {
-        return map.size();
-    }
+	public int size() {
+		return map.size();
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/PermutingFrameTupleReference.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/PermutingFrameTupleReference.java
index 3db9db2..0b296f0 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/PermutingFrameTupleReference.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/PermutingFrameTupleReference.java
@@ -19,47 +19,47 @@
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class PermutingFrameTupleReference implements IFrameTupleReference {
-    private IFrameTupleAccessor fta;
-    private int tIndex;
-    private int[] fieldPermutation;
+	private IFrameTupleAccessor fta;
+	private int tIndex;
+	private int[] fieldPermutation;
 
-    public void setFieldPermutation(int[] fieldPermutation) {
-        this.fieldPermutation = fieldPermutation;
-    }
+	public void setFieldPermutation(int[] fieldPermutation) {
+		this.fieldPermutation = fieldPermutation;
+	}
 
-    public void reset(IFrameTupleAccessor fta, int tIndex) {
-        this.fta = fta;
-        this.tIndex = tIndex;
-    }
+	public void reset(IFrameTupleAccessor fta, int tIndex) {
+		this.fta = fta;
+		this.tIndex = tIndex;
+	}
 
-    @Override
-    public IFrameTupleAccessor getFrameTupleAccessor() {
-        return fta;
-    }
+	@Override
+	public IFrameTupleAccessor getFrameTupleAccessor() {
+		return fta;
+	}
 
-    @Override
-    public int getTupleIndex() {
-        return tIndex;
-    }
+	@Override
+	public int getTupleIndex() {
+		return tIndex;
+	}
 
-    @Override
-    public int getFieldCount() {
-        return fieldPermutation.length;
-    }
+	@Override
+	public int getFieldCount() {
+		return fieldPermutation.length;
+	}
 
-    @Override
-    public byte[] getFieldData(int fIdx) {
-        return fta.getBuffer().array();
-    }
+	@Override
+	public byte[] getFieldData(int fIdx) {
+		return fta.getBuffer().array();
+	}
 
-    @Override
-    public int getFieldStart(int fIdx) {
-        return fta.getTupleStartOffset(tIndex) + fta.getFieldSlotsLength()
-                + fta.getFieldStartOffset(tIndex, fieldPermutation[fIdx]);
-    }
+	@Override
+	public int getFieldStart(int fIdx) {
+		return fta.getTupleStartOffset(tIndex) + fta.getFieldSlotsLength()
+				+ fta.getFieldStartOffset(tIndex, fieldPermutation[fIdx]);
+	}
 
-    @Override
-    public int getFieldLength(int fIdx) {
-        return fta.getFieldLength(tIndex, fieldPermutation[fIdx]);
-    }
+	@Override
+	public int getFieldLength(int fIdx) {
+		return fta.getFieldLength(tIndex, fieldPermutation[fIdx]);
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
index fc12f59..5076c56 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
@@ -23,32 +23,43 @@
 import edu.uci.ics.hyracks.api.job.IOperatorEnvironment;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public class TreeIndexBulkLoadOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexBulkLoadOperatorDescriptor extends
+		AbstractTreeIndexOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    private final int[] fieldPermutation;
-    private final float fillFactor;
+	private final int[] fieldPermutation;
+	private final float fillFactor;
 
-    public TreeIndexBulkLoadOperatorDescriptor(JobSpecification spec, IStorageManagerInterface storageManager,
-            IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider, IFileSplitProvider fileSplitProvider,
-            ITreeIndexFrameFactory interiorFrameFactory, ITreeIndexFrameFactory leafFrameFactory,
-            ITypeTrait[] typeTraits, IBinaryComparatorFactory[] comparatorFactories, int[] fieldPermutation,
-            float fillFactor, ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, 1, 0, null, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
-        this.fieldPermutation = fieldPermutation;
-        this.fillFactor = fillFactor;
-    }
+	public TreeIndexBulkLoadOperatorDescriptor(JobSpecification spec,
+			IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			IBinaryComparatorFactory[] comparatorFactories,
+			IPrimitiveValueProviderFactory[] valueProviderFactories,
+			int[] fieldPermutation, float fillFactor,
+			ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, 1, 0, null, storageManager, treeIndexRegistryProvider,
+				fileSplitProvider, interiorFrameFactory, leafFrameFactory,
+				typeTraits, comparatorFactories, valueProviderFactories,
+				opHelperFactory);
+		this.fieldPermutation = fieldPermutation;
+		this.fillFactor = fillFactor;
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
-        return new TreeIndexBulkLoadOperatorNodePushable(this, ctx, partition, fieldPermutation, fillFactor,
-                recordDescProvider);
-    }
-}
+	@Override
+	public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
+			IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int nPartitions) {
+		return new TreeIndexBulkLoadOperatorNodePushable(this, ctx, partition,
+				fieldPermutation, fillFactor, recordDescProvider);
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java
index aced388..42dfaab 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java
@@ -26,64 +26,73 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
 import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrame;
 
-public class TreeIndexBulkLoadOperatorNodePushable extends AbstractUnaryInputSinkOperatorNodePushable {
-    private float fillFactor;
-    private final TreeIndexOpHelper treeIndexOpHelper;
-    private FrameTupleAccessor accessor;
-    private IIndexBulkLoadContext bulkLoadCtx;
+public class TreeIndexBulkLoadOperatorNodePushable extends
+		AbstractUnaryInputSinkOperatorNodePushable {
+	private float fillFactor;
+	private final TreeIndexOpHelper treeIndexOpHelper;
+	private FrameTupleAccessor accessor;
+	private IIndexBulkLoadContext bulkLoadCtx;
 
-    private IRecordDescriptorProvider recordDescProvider;
+	private IRecordDescriptorProvider recordDescProvider;
 
-    private PermutingFrameTupleReference tuple = new PermutingFrameTupleReference();
+	private PermutingFrameTupleReference tuple = new PermutingFrameTupleReference();
 
-    public TreeIndexBulkLoadOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc, IHyracksTaskContext ctx,
-            int partition, int[] fieldPermutation, float fillFactor, IRecordDescriptorProvider recordDescProvider) {
-        treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory().createTreeIndexOpHelper(opDesc, ctx, partition,
-                IndexHelperOpenMode.CREATE);
-        this.fillFactor = fillFactor;
-        this.recordDescProvider = recordDescProvider;
-        tuple.setFieldPermutation(fieldPermutation);
-    }
+	public TreeIndexBulkLoadOperatorNodePushable(
+			AbstractTreeIndexOperatorDescriptor opDesc,
+			IHyracksTaskContext ctx, int partition, int[] fieldPermutation,
+			float fillFactor, IRecordDescriptorProvider recordDescProvider) {
+		treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory()
+				.createTreeIndexOpHelper(opDesc, ctx, partition,
+						IndexHelperOpenMode.CREATE);
+		this.fillFactor = fillFactor;
+		this.recordDescProvider = recordDescProvider;
+		tuple.setFieldPermutation(fieldPermutation);
+	}
 
-    @Override
-    public void open() throws HyracksDataException {
-        AbstractTreeIndexOperatorDescriptor opDesc = (AbstractTreeIndexOperatorDescriptor) treeIndexOpHelper
-                .getOperatorDescriptor();
-        RecordDescriptor recDesc = recordDescProvider.getInputRecordDescriptor(opDesc.getOperatorId(), 0);
-        accessor = new FrameTupleAccessor(treeIndexOpHelper.getHyracksTaskContext().getFrameSize(), recDesc);
-        ITreeIndexMetaDataFrame metaFrame = new LIFOMetaDataFrame();
-        try {
-            treeIndexOpHelper.init();
-            treeIndexOpHelper.getTreeIndex().open(treeIndexOpHelper.getIndexFileId());
-            bulkLoadCtx = treeIndexOpHelper.getTreeIndex().beginBulkLoad(fillFactor, treeIndexOpHelper.getLeafFrame(),
-                    treeIndexOpHelper.getInteriorFrame(), metaFrame);
-        } catch (Exception e) {
-            // cleanup in case of failure
-            treeIndexOpHelper.deinit();
-            throw new HyracksDataException(e);
-        }
-    }
+	@Override
+	public void open() throws HyracksDataException {
+		AbstractTreeIndexOperatorDescriptor opDesc = (AbstractTreeIndexOperatorDescriptor) treeIndexOpHelper
+				.getOperatorDescriptor();
+		RecordDescriptor recDesc = recordDescProvider.getInputRecordDescriptor(
+				opDesc.getOperatorId(), 0);
+		accessor = new FrameTupleAccessor(treeIndexOpHelper
+				.getHyracksTaskContext().getFrameSize(), recDesc);
+		ITreeIndexMetaDataFrame metaFrame = new LIFOMetaDataFrame();
+		try {
+			treeIndexOpHelper.init();
+			treeIndexOpHelper.getTreeIndex().open(
+					treeIndexOpHelper.getIndexFileId());
+			bulkLoadCtx = treeIndexOpHelper.getTreeIndex().beginBulkLoad(
+					fillFactor, treeIndexOpHelper.getLeafFrame(),
+					treeIndexOpHelper.getInteriorFrame(), metaFrame);
+		} catch (Exception e) {
+			// cleanup in case of failure
+			treeIndexOpHelper.deinit();
+			throw new HyracksDataException(e);
+		}
+	}
 
-    @Override
-    public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
-        accessor.reset(buffer);
-        int tupleCount = accessor.getTupleCount();
-        for (int i = 0; i < tupleCount; i++) {
-            tuple.reset(accessor, i);
-            treeIndexOpHelper.getTreeIndex().bulkLoadAddTuple(bulkLoadCtx, tuple);
-        }
-    }
+	@Override
+	public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
+		accessor.reset(buffer);
+		int tupleCount = accessor.getTupleCount();
+		for (int i = 0; i < tupleCount; i++) {
+			tuple.reset(accessor, i);
+			treeIndexOpHelper.getTreeIndex().bulkLoadAddTuple(bulkLoadCtx,
+					tuple);
+		}
+	}
 
-    @Override
-    public void close() throws HyracksDataException {
-        try {
-            treeIndexOpHelper.getTreeIndex().endBulkLoad(bulkLoadCtx);
-        } finally {
-            treeIndexOpHelper.deinit();
-        }
-    }
+	@Override
+	public void close() throws HyracksDataException {
+		try {
+			treeIndexOpHelper.getTreeIndex().endBulkLoad(bulkLoadCtx);
+		} finally {
+			treeIndexOpHelper.deinit();
+		}
+	}
 
-    @Override
-    public void fail() throws HyracksDataException {
-    }
+	@Override
+	public void fail() throws HyracksDataException {
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
index 3a6eb62..5fcb49a 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
@@ -27,21 +27,29 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public class TreeIndexDiskOrderScanOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexDiskOrderScanOperatorDescriptor extends
+		AbstractTreeIndexOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    public TreeIndexDiskOrderScanOperatorDescriptor(JobSpecification spec, RecordDescriptor recDesc,
-            IStorageManagerInterface storageManager, IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
-            IFileSplitProvider fileSplitProvider, ITreeIndexFrameFactory interiorFrameFactory,
-            ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits, ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, 0, 1, recDesc, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, null, opHelperFactory);
-    }
+	public TreeIndexDiskOrderScanOperatorDescriptor(JobSpecification spec,
+			RecordDescriptor recDesc, IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, 0, 1, recDesc, storageManager, treeIndexRegistryProvider,
+				fileSplitProvider, interiorFrameFactory, leafFrameFactory,
+				typeTraits, null, null, opHelperFactory);
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
-        return new TreeIndexDiskOrderScanOperatorNodePushable(this, ctx, partition);
-    }
+	@Override
+	public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
+			IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int nPartitions) {
+		return new TreeIndexDiskOrderScanOperatorNodePushable(this, ctx,
+				partition);
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
index 2703137..0b22148 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
@@ -31,77 +31,91 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOp;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOpContext;
 
-public class TreeIndexDiskOrderScanOperatorNodePushable extends AbstractUnaryOutputSourceOperatorNodePushable {
-    private final TreeIndexOpHelper treeIndexOpHelper;
+public class TreeIndexDiskOrderScanOperatorNodePushable extends
+		AbstractUnaryOutputSourceOperatorNodePushable {
+	private final TreeIndexOpHelper treeIndexOpHelper;
 
-    public TreeIndexDiskOrderScanOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc,
-            IHyracksTaskContext ctx, int partition) {
-        treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory().createTreeIndexOpHelper(opDesc, ctx, partition,
-                IndexHelperOpenMode.OPEN);
-    }
+	public TreeIndexDiskOrderScanOperatorNodePushable(
+			AbstractTreeIndexOperatorDescriptor opDesc,
+			IHyracksTaskContext ctx, int partition) {
+		treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory()
+				.createTreeIndexOpHelper(opDesc, ctx, partition,
+						IndexHelperOpenMode.OPEN);
+	}
 
-    @Override
-    public void initialize() throws HyracksDataException {
+	@Override
+	public void initialize() throws HyracksDataException {
 
-        ITreeIndexFrame cursorFrame = treeIndexOpHelper.getOperatorDescriptor().getTreeIndexLeafFactory().createFrame();
-        ITreeIndexCursor cursor = treeIndexOpHelper.createDiskOrderScanCursor(cursorFrame);
-        ITreeIndexMetaDataFrame metaFrame = new LIFOMetaDataFrame();
+		ITreeIndexFrame cursorFrame = treeIndexOpHelper.getOperatorDescriptor()
+				.getTreeIndexLeafFactory().createFrame();
+		ITreeIndexCursor cursor = treeIndexOpHelper
+				.createDiskOrderScanCursor(cursorFrame);
+		ITreeIndexMetaDataFrame metaFrame = new LIFOMetaDataFrame();
 
-        IndexOpContext diskOrderScanOpCtx = treeIndexOpHelper.getTreeIndex().createOpContext(IndexOp.DISKORDERSCAN,
-                cursorFrame, null, null);
-        try {
+		IndexOpContext diskOrderScanOpCtx = treeIndexOpHelper
+				.getTreeIndex()
+				.createOpContext(IndexOp.DISKORDERSCAN, cursorFrame, null, null);
+		try {
 
-            treeIndexOpHelper.init();
-            writer.open();
-            try {
-                treeIndexOpHelper.getTreeIndex().diskOrderScan(cursor, cursorFrame, metaFrame, diskOrderScanOpCtx);
+			treeIndexOpHelper.init();
+			writer.open();
+			try {
+				treeIndexOpHelper.getTreeIndex().diskOrderScan(cursor,
+						cursorFrame, metaFrame, diskOrderScanOpCtx);
 
-                int fieldCount = treeIndexOpHelper.getTreeIndex().getFieldCount();
-                ByteBuffer frame = treeIndexOpHelper.getHyracksTaskContext().allocateFrame();
-                FrameTupleAppender appender = new FrameTupleAppender(treeIndexOpHelper.getHyracksTaskContext()
-                        .getFrameSize());
-                appender.reset(frame, true);
-                ArrayTupleBuilder tb = new ArrayTupleBuilder(fieldCount);
-                DataOutput dos = tb.getDataOutput();
+				int fieldCount = treeIndexOpHelper.getTreeIndex()
+						.getFieldCount();
+				ByteBuffer frame = treeIndexOpHelper.getHyracksTaskContext()
+						.allocateFrame();
+				FrameTupleAppender appender = new FrameTupleAppender(
+						treeIndexOpHelper.getHyracksTaskContext()
+								.getFrameSize());
+				appender.reset(frame, true);
+				ArrayTupleBuilder tb = new ArrayTupleBuilder(fieldCount);
+				DataOutput dos = tb.getDataOutput();
 
-                while (cursor.hasNext()) {
-                    tb.reset();
-                    cursor.next();
+				while (cursor.hasNext()) {
+					tb.reset();
+					cursor.next();
 
-                    ITupleReference frameTuple = cursor.getTuple();
-                    for (int i = 0; i < frameTuple.getFieldCount(); i++) {
-                        dos.write(frameTuple.getFieldData(i), frameTuple.getFieldStart(i), frameTuple.getFieldLength(i));
-                        tb.addFieldEndOffset();
-                    }
+					ITupleReference frameTuple = cursor.getTuple();
+					for (int i = 0; i < frameTuple.getFieldCount(); i++) {
+						dos.write(frameTuple.getFieldData(i),
+								frameTuple.getFieldStart(i),
+								frameTuple.getFieldLength(i));
+						tb.addFieldEndOffset();
+					}
 
-                    if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
-                        FrameUtils.flushFrame(frame, writer);
-                        appender.reset(frame, true);
-                        if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
-                            throw new IllegalStateException();
-                        }
-                    }
-                }
+					if (!appender.append(tb.getFieldEndOffsets(),
+							tb.getByteArray(), 0, tb.getSize())) {
+						FrameUtils.flushFrame(frame, writer);
+						appender.reset(frame, true);
+						if (!appender.append(tb.getFieldEndOffsets(),
+								tb.getByteArray(), 0, tb.getSize())) {
+							throw new IllegalStateException();
+						}
+					}
+				}
 
-                if (appender.getTupleCount() > 0) {
-                    FrameUtils.flushFrame(frame, writer);
-                }
-            } catch (Exception e) {
-                writer.fail();
-                throw new HyracksDataException(e);
-            } finally {
-                cursor.close();
-                writer.close();
-            }
+				if (appender.getTupleCount() > 0) {
+					FrameUtils.flushFrame(frame, writer);
+				}
+			} catch (Exception e) {
+				writer.fail();
+				throw new HyracksDataException(e);
+			} finally {
+				cursor.close();
+				writer.close();
+			}
 
-        } catch (Exception e) {
-            deinitialize();
-            throw new HyracksDataException(e);
-        }
-    }
+		} catch (Exception e) {
+			deinitialize();
+			throw new HyracksDataException(e);
+		}
+	}
 
-    @Override
-    public void deinitialize() throws HyracksDataException {
-        treeIndexOpHelper.deinit();
-    }
+	@Override
+	public void deinitialize() throws HyracksDataException {
+		treeIndexOpHelper.deinit();
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorDescriptor.java
index 2b1de29..0053877 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorDescriptor.java
@@ -25,26 +25,31 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public class TreeIndexDropOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor {
+public class TreeIndexDropOperatorDescriptor extends
+		AbstractSingleActivityOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    private IStorageManagerInterface storageManager;
-    private IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider;
-    private IFileSplitProvider fileSplitProvider;
+	private IStorageManagerInterface storageManager;
+	private IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider;
+	private IFileSplitProvider fileSplitProvider;
 
-    public TreeIndexDropOperatorDescriptor(JobSpecification spec, IStorageManagerInterface storageManager,
-            IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider, IFileSplitProvider fileSplitProvider) {
-        super(spec, 0, 0);
-        this.storageManager = storageManager;
-        this.treeIndexRegistryProvider = treeIndexRegistryProvider;
-        this.fileSplitProvider = fileSplitProvider;
-    }
+	public TreeIndexDropOperatorDescriptor(JobSpecification spec,
+			IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider) {
+		super(spec, 0, 0);
+		this.storageManager = storageManager;
+		this.treeIndexRegistryProvider = treeIndexRegistryProvider;
+		this.fileSplitProvider = fileSplitProvider;
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
-        return new TreeIndexDropOperatorNodePushable(ctx, storageManager, treeIndexRegistryProvider, fileSplitProvider,
-                partition);
-    }
+	@Override
+	public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
+			IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int nPartitions) {
+		return new TreeIndexDropOperatorNodePushable(ctx, storageManager,
+				treeIndexRegistryProvider, fileSplitProvider, partition);
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorNodePushable.java
index 9b4ecb0..6614fba 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDropOperatorNodePushable.java
@@ -30,79 +30,87 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
 
-public class TreeIndexDropOperatorNodePushable extends AbstractOperatorNodePushable {
-    private static final Logger LOGGER = Logger.getLogger(TreeIndexDropOperatorNodePushable.class.getName());
+public class TreeIndexDropOperatorNodePushable extends
+		AbstractOperatorNodePushable {
+	private static final Logger LOGGER = Logger
+			.getLogger(TreeIndexDropOperatorNodePushable.class.getName());
 
-    private final IHyracksTaskContext ctx;
-    private IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider;
-    private IStorageManagerInterface storageManager;
-    private IFileSplitProvider fileSplitProvider;
-    private int partition;
+	private final IHyracksTaskContext ctx;
+	private IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider;
+	private IStorageManagerInterface storageManager;
+	private IFileSplitProvider fileSplitProvider;
+	private int partition;
 
-    public TreeIndexDropOperatorNodePushable(IHyracksTaskContext ctx, IStorageManagerInterface storageManager,
-            IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider, IFileSplitProvider fileSplitProvider,
-            int partition) {
-        this.ctx = ctx;
-        this.storageManager = storageManager;
-        this.treeIndexRegistryProvider = treeIndexRegistryProvider;
-        this.fileSplitProvider = fileSplitProvider;
-        this.partition = partition;
-    }
+	public TreeIndexDropOperatorNodePushable(IHyracksTaskContext ctx,
+			IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider, int partition) {
+		this.ctx = ctx;
+		this.storageManager = storageManager;
+		this.treeIndexRegistryProvider = treeIndexRegistryProvider;
+		this.fileSplitProvider = fileSplitProvider;
+		this.partition = partition;
+	}
 
-    @Override
-    public void deinitialize() throws HyracksDataException {
-    }
+	@Override
+	public void deinitialize() throws HyracksDataException {
+	}
 
-    @Override
-    public int getInputArity() {
-        return 0;
-    }
+	@Override
+	public int getInputArity() {
+		return 0;
+	}
 
-    @Override
-    public IFrameWriter getInputFrameWriter(int index) {
-        return null;
-    }
+	@Override
+	public IFrameWriter getInputFrameWriter(int index) {
+		return null;
+	}
 
-    @Override
-    public void initialize() throws HyracksDataException {
-        try {
+	@Override
+	public void initialize() throws HyracksDataException {
+		try {
 
-            IndexRegistry<ITreeIndex> treeIndexRegistry = treeIndexRegistryProvider.getRegistry(ctx);
-            IBufferCache bufferCache = storageManager.getBufferCache(ctx);
-            IFileMapProvider fileMapProvider = storageManager.getFileMapProvider(ctx);
+			IndexRegistry<ITreeIndex> treeIndexRegistry = treeIndexRegistryProvider
+					.getRegistry(ctx);
+			IBufferCache bufferCache = storageManager.getBufferCache(ctx);
+			IFileMapProvider fileMapProvider = storageManager
+					.getFileMapProvider(ctx);
 
-            FileReference f = fileSplitProvider.getFileSplits()[partition].getLocalFile();
+			FileReference f = fileSplitProvider.getFileSplits()[partition]
+					.getLocalFile();
 
-            boolean fileIsMapped = fileMapProvider.isMapped(f);
-            if (!fileIsMapped) {
-                throw new HyracksDataException("Cannot drop Tree with name " + f.toString()
-                        + ". No file mapping exists.");
-            }
+			boolean fileIsMapped = fileMapProvider.isMapped(f);
+			if (!fileIsMapped) {
+				throw new HyracksDataException("Cannot drop Tree with name "
+						+ f.toString() + ". No file mapping exists.");
+			}
 
-            int indexFileId = fileMapProvider.lookupFileId(f);
+			int indexFileId = fileMapProvider.lookupFileId(f);
 
-            // unregister tree instance
-            treeIndexRegistry.lock();
-            try {
-                treeIndexRegistry.unregister(indexFileId);
-            } finally {
-                treeIndexRegistry.unlock();
-            }
+			// unregister tree instance
+			treeIndexRegistry.lock();
+			try {
+				treeIndexRegistry.unregister(indexFileId);
+			} finally {
+				treeIndexRegistry.unlock();
+			}
 
-            // remove name to id mapping
-            bufferCache.deleteFile(indexFileId);
-        }
-        // TODO: for the time being we don't throw,
-        // with proper exception handling (no hanging job problem) we should
-        // throw
-        catch (Exception e) {
-            if (LOGGER.isLoggable(Level.WARNING)) {
-                LOGGER.warning("Tree Drop Operator Failed Due To Exception: " + e.getMessage());
-            }
-        }
-    }
+			// remove name to id mapping
+			bufferCache.deleteFile(indexFileId);
+		}
+		// TODO: for the time being we don't throw,
+		// with proper exception handling (no hanging job problem) we should
+		// throw
+		catch (Exception e) {
+			if (LOGGER.isLoggable(Level.WARNING)) {
+				LOGGER.warning("Tree Drop Operator Failed Due To Exception: "
+						+ e.getMessage());
+			}
+		}
+	}
 
-    @Override
-    public void setOutputFrameWriter(int index, IFrameWriter writer, RecordDescriptor recordDesc) {
-    }
+	@Override
+	public void setOutputFrameWriter(int index, IFrameWriter writer,
+			RecordDescriptor recordDesc) {
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorDescriptor.java
index 7812198..60fa8cc 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorDescriptor.java
@@ -25,6 +25,7 @@
 import edu.uci.ics.hyracks.api.job.IOperatorEnvironment;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
@@ -34,23 +35,33 @@
 // 2. create file mappings (FileMappingProvider)
 // 3. register tree index instance (IndexRegistry)
 
-public class TreeIndexFileEnlistmentOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexFileEnlistmentOperatorDescriptor extends
+		AbstractTreeIndexOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    public TreeIndexFileEnlistmentOperatorDescriptor(JobSpecification spec, RecordDescriptor recDesc,
-            IStorageManagerInterface storageManager, IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
-            IFileSplitProvider fileSplitProvider, ITreeIndexFrameFactory interiorFrameFactory,
-            ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
-            IBinaryComparatorFactory[] comparatorFactories, ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, 0, 0, recDesc, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
-    }
+	public TreeIndexFileEnlistmentOperatorDescriptor(JobSpecification spec,
+			RecordDescriptor recDesc, IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			IBinaryComparatorFactory[] comparatorFactories,
+			IPrimitiveValueProviderFactory[] valueProviderFactories,
+			ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, 0, 0, recDesc, storageManager, treeIndexRegistryProvider,
+				fileSplitProvider, interiorFrameFactory, leafFrameFactory,
+				typeTraits, comparatorFactories, valueProviderFactories,
+				opHelperFactory);
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int partitions) throws HyracksDataException {
-        return new TreeIndexFileEnlistmentOperatorNodePushable(this, ctx, partition);
-    }
+	@Override
+	public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
+			IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int partitions) throws HyracksDataException {
+		return new TreeIndexFileEnlistmentOperatorNodePushable(this, ctx,
+				partition);
+	}
 
-}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorNodePushable.java
index 9cbde53..124e2cc 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexFileEnlistmentOperatorNodePushable.java
@@ -21,40 +21,44 @@
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.dataflow.std.base.AbstractOperatorNodePushable;
 
-public class TreeIndexFileEnlistmentOperatorNodePushable extends AbstractOperatorNodePushable {
+public class TreeIndexFileEnlistmentOperatorNodePushable extends
+		AbstractOperatorNodePushable {
 
-    private final TreeIndexOpHelper treeIndexOpHelper;
+	private final TreeIndexOpHelper treeIndexOpHelper;
 
-    public TreeIndexFileEnlistmentOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc,
-            IHyracksTaskContext ctx, int partition) {
-        treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory().createTreeIndexOpHelper(opDesc, ctx, partition,
-                IndexHelperOpenMode.ENLIST);
-    }
+	public TreeIndexFileEnlistmentOperatorNodePushable(
+			AbstractTreeIndexOperatorDescriptor opDesc,
+			IHyracksTaskContext ctx, int partition) {
+		treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory()
+				.createTreeIndexOpHelper(opDesc, ctx, partition,
+						IndexHelperOpenMode.ENLIST);
+	}
 
-    @Override
-    public void deinitialize() throws HyracksDataException {
-    }
+	@Override
+	public void deinitialize() throws HyracksDataException {
+	}
 
-    @Override
-    public int getInputArity() {
-        return 0;
-    }
+	@Override
+	public int getInputArity() {
+		return 0;
+	}
 
-    @Override
-    public IFrameWriter getInputFrameWriter(int index) {
-        return null;
-    }
+	@Override
+	public IFrameWriter getInputFrameWriter(int index) {
+		return null;
+	}
 
-    @Override
-    public void initialize() throws HyracksDataException {
-        try {
-            treeIndexOpHelper.init();
-        } finally {
-            treeIndexOpHelper.deinit();
-        }
-    }
+	@Override
+	public void initialize() throws HyracksDataException {
+		try {
+			treeIndexOpHelper.init();
+		} finally {
+			treeIndexOpHelper.deinit();
+		}
+	}
 
-    @Override
-    public void setOutputFrameWriter(int index, IFrameWriter writer, RecordDescriptor recordDesc) {
-    }
+	@Override
+	public void setOutputFrameWriter(int index, IFrameWriter writer,
+			RecordDescriptor recordDesc) {
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
index 0457768..b41bd98 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
@@ -24,35 +24,45 @@
 import edu.uci.ics.hyracks.api.job.IOperatorEnvironment;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOp;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public class TreeIndexInsertUpdateDeleteOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexInsertUpdateDeleteOperatorDescriptor extends
+		AbstractTreeIndexOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    private final int[] fieldPermutation;
+	private final int[] fieldPermutation;
 
-    private IndexOp op;
+	private IndexOp op;
 
-    public TreeIndexInsertUpdateDeleteOperatorDescriptor(JobSpecification spec, RecordDescriptor recDesc,
-            IStorageManagerInterface storageManager, IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
-            IFileSplitProvider fileSplitProvider, ITreeIndexFrameFactory interiorFrameFactory,
-            ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
-            IBinaryComparatorFactory[] comparatorFactories, int[] fieldPermutation, IndexOp op,
-            ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, 1, 1, recDesc, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
-        this.fieldPermutation = fieldPermutation;
-        this.op = op;
-    }
+	public TreeIndexInsertUpdateDeleteOperatorDescriptor(JobSpecification spec,
+			RecordDescriptor recDesc, IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			IBinaryComparatorFactory[] comparatorFactories,
+			IPrimitiveValueProviderFactory[] valueProviderFactories,
+			int[] fieldPermutation, IndexOp op,
+			ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, 1, 1, recDesc, storageManager, treeIndexRegistryProvider,
+				fileSplitProvider, interiorFrameFactory, leafFrameFactory,
+				typeTraits, comparatorFactories, valueProviderFactories,
+				opHelperFactory);
+		this.fieldPermutation = fieldPermutation;
+		this.op = op;
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
-        return new TreeIndexInsertUpdateDeleteOperatorNodePushable(this, ctx, partition, fieldPermutation,
-                recordDescProvider, op);
-    }
-}
+	@Override
+	public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
+			IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int nPartitions) {
+		return new TreeIndexInsertUpdateDeleteOperatorNodePushable(this, ctx,
+				partition, fieldPermutation, recordDescProvider, op);
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java
index 5779805..cc49998 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java
@@ -28,95 +28,104 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOp;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOpContext;
 
-public class TreeIndexInsertUpdateDeleteOperatorNodePushable extends AbstractUnaryInputUnaryOutputOperatorNodePushable {
-    private final TreeIndexOpHelper treeIndexOpHelper;
-    private FrameTupleAccessor accessor;
-    private final IRecordDescriptorProvider recordDescProvider;
-    private final IndexOp op;
-    private final PermutingFrameTupleReference tuple = new PermutingFrameTupleReference();
-    private ByteBuffer writeBuffer;
-    private IndexOpContext opCtx;
+public class TreeIndexInsertUpdateDeleteOperatorNodePushable extends
+		AbstractUnaryInputUnaryOutputOperatorNodePushable {
+	private final TreeIndexOpHelper treeIndexOpHelper;
+	private FrameTupleAccessor accessor;
+	private final IRecordDescriptorProvider recordDescProvider;
+	private final IndexOp op;
+	private final PermutingFrameTupleReference tuple = new PermutingFrameTupleReference();
+	private ByteBuffer writeBuffer;
+	private IndexOpContext opCtx;
 
-    public TreeIndexInsertUpdateDeleteOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc,
-            IHyracksTaskContext ctx, int partition, int[] fieldPermutation,
-            IRecordDescriptorProvider recordDescProvider, IndexOp op) {
-        treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory().createTreeIndexOpHelper(opDesc, ctx, partition,
-                IndexHelperOpenMode.OPEN);
-        this.recordDescProvider = recordDescProvider;
-        this.op = op;
-        tuple.setFieldPermutation(fieldPermutation);
-    }
+	public TreeIndexInsertUpdateDeleteOperatorNodePushable(
+			AbstractTreeIndexOperatorDescriptor opDesc,
+			IHyracksTaskContext ctx, int partition, int[] fieldPermutation,
+			IRecordDescriptorProvider recordDescProvider, IndexOp op) {
+		treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory()
+				.createTreeIndexOpHelper(opDesc, ctx, partition,
+						IndexHelperOpenMode.OPEN);
+		this.recordDescProvider = recordDescProvider;
+		this.op = op;
+		tuple.setFieldPermutation(fieldPermutation);
+	}
 
-    @Override
-    public void open() throws HyracksDataException {
-        AbstractTreeIndexOperatorDescriptor opDesc = (AbstractTreeIndexOperatorDescriptor) treeIndexOpHelper
-                .getOperatorDescriptor();
-        RecordDescriptor inputRecDesc = recordDescProvider.getInputRecordDescriptor(opDesc.getOperatorId(), 0);
-        accessor = new FrameTupleAccessor(treeIndexOpHelper.getHyracksTaskContext().getFrameSize(), inputRecDesc);
-        writeBuffer = treeIndexOpHelper.getHyracksTaskContext().allocateFrame();
-        writer.open();
-        try {
-            treeIndexOpHelper.init();
-            treeIndexOpHelper.getTreeIndex().open(treeIndexOpHelper.getIndexFileId());
-            opCtx = treeIndexOpHelper.getTreeIndex().createOpContext(op, treeIndexOpHelper.getLeafFrame(),
-                    treeIndexOpHelper.getInteriorFrame(), new LIFOMetaDataFrame());
-        } catch (Exception e) {
-            // cleanup in case of failure
-            treeIndexOpHelper.deinit();
-            throw new HyracksDataException(e);
-        }
-    }
+	@Override
+	public void open() throws HyracksDataException {
+		AbstractTreeIndexOperatorDescriptor opDesc = (AbstractTreeIndexOperatorDescriptor) treeIndexOpHelper
+				.getOperatorDescriptor();
+		RecordDescriptor inputRecDesc = recordDescProvider
+				.getInputRecordDescriptor(opDesc.getOperatorId(), 0);
+		accessor = new FrameTupleAccessor(treeIndexOpHelper
+				.getHyracksTaskContext().getFrameSize(), inputRecDesc);
+		writeBuffer = treeIndexOpHelper.getHyracksTaskContext().allocateFrame();
+		writer.open();
+		try {
+			treeIndexOpHelper.init();
+			treeIndexOpHelper.getTreeIndex().open(
+					treeIndexOpHelper.getIndexFileId());
+			opCtx = treeIndexOpHelper.getTreeIndex().createOpContext(op,
+					treeIndexOpHelper.getLeafFrame(),
+					treeIndexOpHelper.getInteriorFrame(),
+					new LIFOMetaDataFrame());
+		} catch (Exception e) {
+			// cleanup in case of failure
+			treeIndexOpHelper.deinit();
+			throw new HyracksDataException(e);
+		}
+	}
 
-    @Override
-    public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
-        final ITreeIndex treeIndex = treeIndexOpHelper.getTreeIndex();
-        accessor.reset(buffer);
+	@Override
+	public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
+		final ITreeIndex treeIndex = treeIndexOpHelper.getTreeIndex();
+		accessor.reset(buffer);
 
-        int tupleCount = accessor.getTupleCount();
-        for (int i = 0; i < tupleCount; i++) {
-            tuple.reset(accessor, i);
-            try {
-                switch (op) {
+		int tupleCount = accessor.getTupleCount();
+		for (int i = 0; i < tupleCount; i++) {
+			tuple.reset(accessor, i);
+			try {
+				switch (op) {
 
-                    case INSERT: {
-                        treeIndex.insert(tuple, opCtx);
-                    }
-                        break;
+				case INSERT: {
+					treeIndex.insert(tuple, opCtx);
+				}
+					break;
 
-                    case DELETE: {
-                        treeIndex.delete(tuple, opCtx);
-                    }
-                        break;
+				case DELETE: {
+					treeIndex.delete(tuple, opCtx);
+				}
+					break;
 
-                    default: {
-                        throw new HyracksDataException("Unsupported operation " + op
-                                + " in tree index InsertUpdateDelete operator");
-                    }
+				default: {
+					throw new HyracksDataException("Unsupported operation "
+							+ op + " in tree index InsertUpdateDelete operator");
+				}
 
-                }
+				}
 
-            } catch (Exception e) {
-                e.printStackTrace();
-                throw new HyracksDataException(e);
-            }
-        }
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new HyracksDataException(e);
+			}
+		}
 
-        // pass a copy of the frame to next op
-        System.arraycopy(buffer.array(), 0, writeBuffer.array(), 0, buffer.capacity());
-        FrameUtils.flushFrame(writeBuffer, writer);
-    }
+		// pass a copy of the frame to next op
+		System.arraycopy(buffer.array(), 0, writeBuffer.array(), 0,
+				buffer.capacity());
+		FrameUtils.flushFrame(writeBuffer, writer);
+	}
 
-    @Override
-    public void close() throws HyracksDataException {
-        try {
-            writer.close();
-        } finally {
-            treeIndexOpHelper.deinit();
-        }
-    }
+	@Override
+	public void close() throws HyracksDataException {
+		try {
+			writer.close();
+		} finally {
+			treeIndexOpHelper.deinit();
+		}
+	}
 
-    @Override
-    public void fail() throws HyracksDataException {
-        writer.fail();
-    }
+	@Override
+	public void fail() throws HyracksDataException {
+		writer.fail();
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexOpHelper.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexOpHelper.java
index af98bb3..f9fd77d 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexOpHelper.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexOpHelper.java
@@ -30,147 +30,170 @@
 
 public abstract class TreeIndexOpHelper {
 
-    protected ITreeIndexFrame interiorFrame;
-    protected ITreeIndexFrame leafFrame;
-    protected MultiComparator cmp;
+	protected ITreeIndexFrame interiorFrame;
+	protected ITreeIndexFrame leafFrame;
+	protected MultiComparator cmp;
 
-    protected ITreeIndex treeIndex;
-    protected int indexFileId = -1;
-    protected int partition;
+	protected ITreeIndex treeIndex;
+	protected int indexFileId = -1;
+	protected int partition;
 
-    protected ITreeIndexOperatorDescriptorHelper opDesc;
-    protected IHyracksTaskContext ctx;
+	protected ITreeIndexOperatorDescriptorHelper opDesc;
+	protected IHyracksTaskContext ctx;
 
-    protected IndexHelperOpenMode mode;
+	protected IndexHelperOpenMode mode;
 
-    public TreeIndexOpHelper(ITreeIndexOperatorDescriptorHelper opDesc, final IHyracksTaskContext ctx, int partition,
-            IndexHelperOpenMode mode) {
-        this.opDesc = opDesc;
-        this.ctx = ctx;
-        this.mode = mode;
-        this.partition = partition;
-    }
+	public TreeIndexOpHelper(ITreeIndexOperatorDescriptorHelper opDesc,
+			final IHyracksTaskContext ctx, int partition,
+			IndexHelperOpenMode mode) {
+		this.opDesc = opDesc;
+		this.ctx = ctx;
+		this.mode = mode;
+		this.partition = partition;
+	}
 
-    public void init() throws HyracksDataException {
-        IBufferCache bufferCache = opDesc.getStorageManager().getBufferCache(ctx);
-        IFileMapProvider fileMapProvider = opDesc.getStorageManager().getFileMapProvider(ctx);
-        IFileSplitProvider fileSplitProvider = opDesc.getTreeIndexFileSplitProvider();
+	public void init() throws HyracksDataException {
+		IBufferCache bufferCache = opDesc.getStorageManager().getBufferCache(
+				ctx);
+		IFileMapProvider fileMapProvider = opDesc.getStorageManager()
+				.getFileMapProvider(ctx);
+		IFileSplitProvider fileSplitProvider = opDesc
+				.getTreeIndexFileSplitProvider();
 
-        FileReference f = fileSplitProvider.getFileSplits()[partition].getLocalFile();
-        boolean fileIsMapped = fileMapProvider.isMapped(f);
+		FileReference f = fileSplitProvider.getFileSplits()[partition]
+				.getLocalFile();
+		boolean fileIsMapped = fileMapProvider.isMapped(f);
 
-        switch (mode) {
+		switch (mode) {
 
-            case OPEN: {
-                if (!fileIsMapped) {
-                    throw new HyracksDataException("Trying to open tree index from unmapped file " + f.toString());
-                }
-            }
-                break;
+		case OPEN: {
+			if (!fileIsMapped) {
+				throw new HyracksDataException(
+						"Trying to open tree index from unmapped file "
+								+ f.toString());
+			}
+		}
+			break;
 
-            case CREATE:
-            case ENLIST: {
-                if (!fileIsMapped) {
-                    bufferCache.createFile(f);
-                }
-            }
-                break;
+		case CREATE:
+		case ENLIST: {
+			if (!fileIsMapped) {
+				bufferCache.createFile(f);
+			}
+		}
+			break;
 
-        }
+		}
 
-        int fileId = fileMapProvider.lookupFileId(f);
-        try {
-            bufferCache.openFile(fileId);
-        } catch (HyracksDataException e) {
-            // revert state of buffer cache since file failed to open
-            if (!fileIsMapped) {
-                bufferCache.deleteFile(fileId);
-            }
-            throw e;
-        }
+		int fileId = fileMapProvider.lookupFileId(f);
+		try {
+			bufferCache.openFile(fileId);
+		} catch (HyracksDataException e) {
+			// revert state of buffer cache since file failed to open
+			if (!fileIsMapped) {
+				bufferCache.deleteFile(fileId);
+			}
+			throw e;
+		}
 
-        // only set indexFileId member when openFile() succeeds,
-        // otherwise deinit() will try to close the file that failed to open
-        indexFileId = fileId;
+		// only set indexFileId member when openFile() succeeds,
+		// otherwise deinit() will try to close the file that failed to open
+		indexFileId = fileId;
 
-        interiorFrame = opDesc.getTreeIndexInteriorFactory().createFrame();
-        leafFrame = opDesc.getTreeIndexLeafFactory().createFrame();
+		interiorFrame = opDesc.getTreeIndexInteriorFactory().createFrame();
+		leafFrame = opDesc.getTreeIndexLeafFactory().createFrame();
 
-        IndexRegistry<ITreeIndex> treeIndexRegistry = opDesc.getTreeIndexRegistryProvider().getRegistry(ctx);
-        treeIndex = treeIndexRegistry.get(indexFileId);
-        if (treeIndex == null) {
+		IndexRegistry<ITreeIndex> treeIndexRegistry = opDesc
+				.getTreeIndexRegistryProvider().getRegistry(ctx);
+		treeIndex = treeIndexRegistry.get(indexFileId);
+		if (treeIndex == null) {
 
-            // create new tree and register it
-            treeIndexRegistry.lock();
-            try {
-                // check if tree has already been registered by another thread
-                treeIndex = treeIndexRegistry.get(indexFileId);
-                if (treeIndex == null) {
-                    // this thread should create and register the tree
+			// create new tree and register it
+			treeIndexRegistry.lock();
+			try {
+				// check if tree has already been registered by another thread
+				treeIndex = treeIndexRegistry.get(indexFileId);
+				if (treeIndex == null) {
+					// this thread should create and register the tree
 
-                    IBinaryComparator[] comparators = new IBinaryComparator[opDesc.getTreeIndexComparatorFactories().length];
-                    for (int i = 0; i < opDesc.getTreeIndexComparatorFactories().length; i++) {
-                        comparators[i] = opDesc.getTreeIndexComparatorFactories()[i].createBinaryComparator();
-                    }
+					IBinaryComparator[] comparators = new IBinaryComparator[opDesc
+							.getTreeIndexComparatorFactories().length];
+					for (int i = 0; i < opDesc
+							.getTreeIndexComparatorFactories().length; i++) {
+						comparators[i] = opDesc
+								.getTreeIndexComparatorFactories()[i]
+								.createBinaryComparator();
+					}
 
-                    cmp = new MultiComparator(opDesc.getTreeIndexTypeTraits(), comparators);
+					cmp = createMultiComparator(comparators);
 
-                    treeIndex = createTreeIndex();
-                    if (mode == IndexHelperOpenMode.CREATE) {
-                        ITreeIndexMetaDataFrame metaFrame = treeIndex.getFreePageManager().getMetaDataFrameFactory()
-                                .createFrame();
-                        try {
-                            treeIndex.create(indexFileId, leafFrame, metaFrame);
-                        } catch (Exception e) {
-                            throw new HyracksDataException(e);
-                        }
-                    }
-                    treeIndex.open(indexFileId);
-                    treeIndexRegistry.register(indexFileId, treeIndex);
-                }
-            } finally {
-                treeIndexRegistry.unlock();
-            }
-        }
-    }
+					treeIndex = createTreeIndex();
+					if (mode == IndexHelperOpenMode.CREATE) {
+						ITreeIndexMetaDataFrame metaFrame = treeIndex
+								.getFreePageManager().getMetaDataFrameFactory()
+								.createFrame();
+						try {
+							treeIndex.create(indexFileId, leafFrame, metaFrame);
+						} catch (Exception e) {
+							throw new HyracksDataException(e);
+						}
+					}
+					treeIndex.open(indexFileId);
+					treeIndexRegistry.register(indexFileId, treeIndex);
+				}
+			} finally {
+				treeIndexRegistry.unlock();
+			}
+		}
+	}
 
-    // MUST be overridden
-    public ITreeIndex createTreeIndex() throws HyracksDataException {
-        throw new HyracksDataException("createTreeIndex Operation not implemented.");
-    }
+	// MUST be overridden
+	public ITreeIndex createTreeIndex() throws HyracksDataException {
+		throw new HyracksDataException(
+				"createTreeIndex Operation not implemented.");
+	}
 
-    public ITreeIndexCursor createDiskOrderScanCursor(ITreeIndexFrame leafFrame) throws HyracksDataException {
-        return new TreeDiskOrderScanCursor(leafFrame);
-    }
+	// MUST be overridden
+	public MultiComparator createMultiComparator(IBinaryComparator[] comparators)
+			throws HyracksDataException {
+		throw new HyracksDataException(
+				"createComparator Operation not implemented.");
+	}
 
-    public void deinit() throws HyracksDataException {
-        if (indexFileId != -1) {
-            IBufferCache bufferCache = opDesc.getStorageManager().getBufferCache(ctx);
-            bufferCache.closeFile(indexFileId);
-        }
-    }
+	public ITreeIndexCursor createDiskOrderScanCursor(ITreeIndexFrame leafFrame)
+			throws HyracksDataException {
+		return new TreeDiskOrderScanCursor(leafFrame);
+	}
 
-    public ITreeIndex getTreeIndex() {
-        return treeIndex;
-    }
+	public void deinit() throws HyracksDataException {
+		if (indexFileId != -1) {
+			IBufferCache bufferCache = opDesc.getStorageManager()
+					.getBufferCache(ctx);
+			bufferCache.closeFile(indexFileId);
+		}
+	}
 
-    public IHyracksTaskContext getHyracksTaskContext() {
-        return ctx;
-    }
+	public ITreeIndex getTreeIndex() {
+		return treeIndex;
+	}
 
-    public ITreeIndexOperatorDescriptorHelper getOperatorDescriptor() {
-        return opDesc;
-    }
+	public IHyracksTaskContext getHyracksTaskContext() {
+		return ctx;
+	}
 
-    public ITreeIndexFrame getLeafFrame() {
-        return leafFrame;
-    }
+	public ITreeIndexOperatorDescriptorHelper getOperatorDescriptor() {
+		return opDesc;
+	}
 
-    public ITreeIndexFrame getInteriorFrame() {
-        return interiorFrame;
-    }
+	public ITreeIndexFrame getLeafFrame() {
+		return leafFrame;
+	}
 
-    public int getIndexFileId() {
-        return indexFileId;
-    }
+	public ITreeIndexFrame getInteriorFrame() {
+		return interiorFrame;
+	}
+
+	public int getIndexFileId() {
+		return indexFileId;
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
index d221e25..d1a1614 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
@@ -12,22 +12,29 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public class TreeIndexStatsOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexStatsOperatorDescriptor extends
+		AbstractTreeIndexOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    public TreeIndexStatsOperatorDescriptor(JobSpecification spec, IStorageManagerInterface storageManager,
-            IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider, IFileSplitProvider fileSplitProvider,
-            ITreeIndexFrameFactory interiorFrameFactory, ITreeIndexFrameFactory leafFrameFactory,
-            ITypeTrait[] typeTraits, IBinaryComparatorFactory[] comparatorFactories,
-            ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, 0, 0, null, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
-    }
+	public TreeIndexStatsOperatorDescriptor(JobSpecification spec,
+			IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			IBinaryComparatorFactory[] comparatorFactories,
+			ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, 0, 0, null, storageManager, treeIndexRegistryProvider,
+				fileSplitProvider, interiorFrameFactory, leafFrameFactory,
+				typeTraits, comparatorFactories, null, opHelperFactory);
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
-        return new TreeIndexStatsOperatorNodePushable(this, ctx, partition);
-    }
-}
+	@Override
+	public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
+			IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int nPartitions) {
+		return new TreeIndexStatsOperatorNodePushable(this, ctx, partition);
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
index 8c825c2..4b53453 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
@@ -24,55 +24,65 @@
 import edu.uci.ics.hyracks.storage.am.common.utility.TreeIndexStatsGatherer;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 
-public class TreeIndexStatsOperatorNodePushable extends AbstractOperatorNodePushable {
-    private final TreeIndexOpHelper treeIndexOpHelper;
-    private final IHyracksTaskContext ctx;
-    private TreeIndexStatsGatherer statsGatherer;
+public class TreeIndexStatsOperatorNodePushable extends
+		AbstractOperatorNodePushable {
+	private final TreeIndexOpHelper treeIndexOpHelper;
+	private final IHyracksTaskContext ctx;
+	private TreeIndexStatsGatherer statsGatherer;
 
-    public TreeIndexStatsOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc, IHyracksTaskContext ctx,
-            int partition) {
-        treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory().createTreeIndexOpHelper(opDesc, ctx, partition,
-                IndexHelperOpenMode.CREATE);
-        this.ctx = ctx;
-    }
+	public TreeIndexStatsOperatorNodePushable(
+			AbstractTreeIndexOperatorDescriptor opDesc,
+			IHyracksTaskContext ctx, int partition) {
+		treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory()
+				.createTreeIndexOpHelper(opDesc, ctx, partition,
+						IndexHelperOpenMode.CREATE);
+		this.ctx = ctx;
+	}
 
-    @Override
-    public void deinitialize() throws HyracksDataException {
-    }
+	@Override
+	public void deinitialize() throws HyracksDataException {
+	}
 
-    @Override
-    public int getInputArity() {
-        return 0;
-    }
+	@Override
+	public int getInputArity() {
+		return 0;
+	}
 
-    @Override
-    public IFrameWriter getInputFrameWriter(int index) {
-        return null;
-    }
+	@Override
+	public IFrameWriter getInputFrameWriter(int index) {
+		return null;
+	}
 
-    @Override
-    public void initialize() throws HyracksDataException {
-        try {
-            treeIndexOpHelper.init();
-            treeIndexOpHelper.getTreeIndex().open(treeIndexOpHelper.getIndexFileId());
+	@Override
+	public void initialize() throws HyracksDataException {
+		try {
+			treeIndexOpHelper.init();
+			treeIndexOpHelper.getTreeIndex().open(
+					treeIndexOpHelper.getIndexFileId());
 
-            ITreeIndex treeIndex = treeIndexOpHelper.getTreeIndex();
-            IBufferCache bufferCache = treeIndexOpHelper.getOperatorDescriptor().getStorageManager()
-                    .getBufferCache(ctx);
+			ITreeIndex treeIndex = treeIndexOpHelper.getTreeIndex();
+			IBufferCache bufferCache = treeIndexOpHelper
+					.getOperatorDescriptor().getStorageManager()
+					.getBufferCache(ctx);
 
-            statsGatherer = new TreeIndexStatsGatherer(bufferCache, treeIndex.getFreePageManager(),
-                    treeIndexOpHelper.getIndexFileId(), treeIndex.getRootPageId());
-            TreeIndexStats stats = statsGatherer.gatherStats(treeIndex.getLeafFrameFactory().createFrame(), treeIndex
-                    .getInteriorFrameFactory().createFrame(), treeIndex.getFreePageManager().getMetaDataFrameFactory()
-                    .createFrame());
-            System.err.println(stats.toString());
-        } catch (Exception e) {
-            treeIndexOpHelper.deinit();
-            throw new HyracksDataException(e);
-        }
-    }
+			statsGatherer = new TreeIndexStatsGatherer(bufferCache,
+					treeIndex.getFreePageManager(),
+					treeIndexOpHelper.getIndexFileId(),
+					treeIndex.getRootPageId());
+			TreeIndexStats stats = statsGatherer.gatherStats(treeIndex
+					.getLeafFrameFactory().createFrame(), treeIndex
+					.getInteriorFrameFactory().createFrame(), treeIndex
+					.getFreePageManager().getMetaDataFrameFactory()
+					.createFrame());
+			System.err.println(stats.toString());
+		} catch (Exception e) {
+			treeIndexOpHelper.deinit();
+			throw new HyracksDataException(e);
+		}
+	}
 
-    @Override
-    public void setOutputFrameWriter(int index, IFrameWriter writer, RecordDescriptor recordDesc) {
-    }
+	@Override
+	public void setOutputFrameWriter(int index, IFrameWriter writer,
+			RecordDescriptor recordDesc) {
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/AbstractSlotManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/AbstractSlotManager.java
index 87fea47..bce2e19 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/AbstractSlotManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/AbstractSlotManager.java
@@ -20,41 +20,42 @@
 
 public abstract class AbstractSlotManager implements ISlotManager {
 
-    protected static final int slotSize = 4;
-    protected ITreeIndexFrame frame;
+	protected static final int slotSize = 4;
+	protected ITreeIndexFrame frame;
 
-    @Override
-    public int getTupleOff(int offset) {
-        return frame.getBuffer().getInt(offset);
-    }
+	@Override
+	public int getTupleOff(int offset) {
+		return frame.getBuffer().getInt(offset);
+	}
 
-    @Override
-    public void setSlot(int offset, int value) {
-        frame.getBuffer().putInt(offset, value);
-    }
+	@Override
+	public void setSlot(int offset, int value) {
+		frame.getBuffer().putInt(offset, value);
+	}
 
-    @Override
-    public int getSlotEndOff() {
-        return frame.getBuffer().capacity() - (frame.getTupleCount() * slotSize);
-    }
+	@Override
+	public int getSlotEndOff() {
+		return frame.getBuffer().capacity()
+				- (frame.getTupleCount() * slotSize);
+	}
 
-    @Override
-    public int getSlotStartOff() {
-        return frame.getBuffer().capacity() - slotSize;
-    }
+	@Override
+	public int getSlotStartOff() {
+		return frame.getBuffer().capacity() - slotSize;
+	}
 
-    @Override
-    public int getSlotSize() {
-        return slotSize;
-    }
+	@Override
+	public int getSlotSize() {
+		return slotSize;
+	}
 
-    @Override
-    public void setFrame(ITreeIndexFrame frame) {
-        this.frame = frame;
-    }
+	@Override
+	public void setFrame(ITreeIndexFrame frame) {
+		this.frame = frame;
+	}
 
-    @Override
-    public int getSlotOff(int tupleIndex) {
-        return getSlotStartOff() - tupleIndex * slotSize;
-    }
+	@Override
+	public int getSlotOff(int tupleIndex) {
+		return getSlotStartOff() - tupleIndex * slotSize;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/FrameOpSpaceStatus.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/FrameOpSpaceStatus.java
index 97a4730..7114875 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/FrameOpSpaceStatus.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/FrameOpSpaceStatus.java
@@ -16,5 +16,5 @@
 package edu.uci.ics.hyracks.storage.am.common.frames;
 
 public enum FrameOpSpaceStatus {
-    INSUFFICIENT_SPACE, SUFFICIENT_CONTIGUOUS_SPACE, SUFFICIENT_SPACE
+	INSUFFICIENT_SPACE, SUFFICIENT_CONTIGUOUS_SPACE, SUFFICIENT_SPACE
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrame.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrame.java
index b621b89..b0ec13d 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrame.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrame.java
@@ -27,89 +27,89 @@
 
 public class LIFOMetaDataFrame implements ITreeIndexMetaDataFrame {
 
-    protected static final int tupleCountOff = 0;
-    protected static final int freeSpaceOff = tupleCountOff + 4;
-    protected static final int maxPageOff = freeSpaceOff + 4;
-    protected static final int dummyFieldOff = maxPageOff + 4;
-    protected static final byte levelOff = dummyFieldOff + 4;
-    protected static final byte nextPageOff = levelOff + 1;
+	protected static final int tupleCountOff = 0;
+	protected static final int freeSpaceOff = tupleCountOff + 4;
+	protected static final int maxPageOff = freeSpaceOff + 4;
+	protected static final int dummyFieldOff = maxPageOff + 4;
+	protected static final byte levelOff = dummyFieldOff + 4;
+	protected static final byte nextPageOff = levelOff + 1;
 
-    protected ICachedPage page = null;
-    protected ByteBuffer buf = null;
+	protected ICachedPage page = null;
+	protected ByteBuffer buf = null;
 
-    public int getMaxPage() {
-        return buf.getInt(maxPageOff);
-    }
+	public int getMaxPage() {
+		return buf.getInt(maxPageOff);
+	}
 
-    public void setMaxPage(int maxPage) {
-        buf.putInt(maxPageOff, maxPage);
-    }
+	public void setMaxPage(int maxPage) {
+		buf.putInt(maxPageOff, maxPage);
+	}
 
-    public int getFreePage() {
-        int tupleCount = buf.getInt(tupleCountOff);
-        if (tupleCount > 0) {
-            // return the last page from the linked list of free pages
-            // TODO: this is a dumb policy, but good enough for now
-            int lastPageOff = buf.getInt(freeSpaceOff) - 4;
-            buf.putInt(freeSpaceOff, lastPageOff);
-            buf.putInt(tupleCountOff, tupleCount - 1);
-            return buf.getInt(lastPageOff);
-        } else {
-            return -1;
-        }
-    }
+	public int getFreePage() {
+		int tupleCount = buf.getInt(tupleCountOff);
+		if (tupleCount > 0) {
+			// return the last page from the linked list of free pages
+			// TODO: this is a dumb policy, but good enough for now
+			int lastPageOff = buf.getInt(freeSpaceOff) - 4;
+			buf.putInt(freeSpaceOff, lastPageOff);
+			buf.putInt(tupleCountOff, tupleCount - 1);
+			return buf.getInt(lastPageOff);
+		} else {
+			return -1;
+		}
+	}
 
-    // must be checked before adding free page
-    // user of this class is responsible for getting a free page as a new meta
-    // page, latching it, etc. if there is no space on this page
-    public boolean hasSpace() {
-        return buf.getInt(freeSpaceOff) + 4 < buf.capacity();
-    }
+	// must be checked before adding free page
+	// user of this class is responsible for getting a free page as a new meta
+	// page, latching it, etc. if there is no space on this page
+	public boolean hasSpace() {
+		return buf.getInt(freeSpaceOff) + 4 < buf.capacity();
+	}
 
-    // on bounds checking is done, there must be free space
-    public void addFreePage(int freePage) {
-        int freeSpace = buf.getInt(freeSpaceOff);
-        buf.putInt(freeSpace, freePage);
-        buf.putInt(freeSpaceOff, freeSpace + 4);
-        buf.putInt(tupleCountOff, buf.getInt(tupleCountOff) + 1);
-    }
+	// on bounds checking is done, there must be free space
+	public void addFreePage(int freePage) {
+		int freeSpace = buf.getInt(freeSpaceOff);
+		buf.putInt(freeSpace, freePage);
+		buf.putInt(freeSpaceOff, freeSpace + 4);
+		buf.putInt(tupleCountOff, buf.getInt(tupleCountOff) + 1);
+	}
 
-    @Override
-    public byte getLevel() {
-        return buf.get(levelOff);
-    }
+	@Override
+	public byte getLevel() {
+		return buf.get(levelOff);
+	}
 
-    @Override
-    public void setLevel(byte level) {
-        buf.put(levelOff, level);
-    }
+	@Override
+	public void setLevel(byte level) {
+		buf.put(levelOff, level);
+	}
 
-    @Override
-    public ICachedPage getPage() {
-        return page;
-    }
+	@Override
+	public ICachedPage getPage() {
+		return page;
+	}
 
-    @Override
-    public void setPage(ICachedPage page) {
-        this.page = page;
-        this.buf = page.getBuffer();
-    }
+	@Override
+	public void setPage(ICachedPage page) {
+		this.page = page;
+		this.buf = page.getBuffer();
+	}
 
-    @Override
-    public void initBuffer(int level) {
-        buf.putInt(freeSpaceOff, nextPageOff + 4);
-        buf.putInt(tupleCountOff, 0);
-        buf.putInt(levelOff, level);
-        buf.putInt(nextPageOff, -1);
-    }
+	@Override
+	public void initBuffer(int level) {
+		buf.putInt(freeSpaceOff, nextPageOff + 4);
+		buf.putInt(tupleCountOff, 0);
+		buf.putInt(levelOff, level);
+		buf.putInt(nextPageOff, -1);
+	}
 
-    @Override
-    public int getNextPage() {
-        return buf.getInt(nextPageOff);
-    }
+	@Override
+	public int getNextPage() {
+		return buf.getInt(nextPageOff);
+	}
 
-    @Override
-    public void setNextPage(int nextPage) {
-        buf.putInt(nextPageOff, nextPage);
-    }
+	@Override
+	public void setNextPage(int nextPage) {
+		buf.putInt(nextPageOff, nextPage);
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrameFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrameFactory.java
index 409c8b2..68d1ee3 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrameFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/LIFOMetaDataFrameFactory.java
@@ -19,8 +19,8 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
 
 public class LIFOMetaDataFrameFactory implements ITreeIndexMetaDataFrameFactory {
-    @Override
-    public ITreeIndexMetaDataFrame createFrame() {
-        return new LIFOMetaDataFrame();
-    }
+	@Override
+	public ITreeIndexMetaDataFrame createFrame() {
+		return new LIFOMetaDataFrame();
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/TreeIndexNSMFrame.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/TreeIndexNSMFrame.java
index af1e337..e5c37ff 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/TreeIndexNSMFrame.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/frames/TreeIndexNSMFrame.java
@@ -38,287 +38,309 @@
 
 public abstract class TreeIndexNSMFrame implements ITreeIndexFrame {
 
-    protected static final int pageLsnOff = 0; // 0
-    protected static final int tupleCountOff = pageLsnOff + 4; // 4
-    protected static final int freeSpaceOff = tupleCountOff + 4; // 8
-    protected static final int totalFreeSpaceOff = freeSpaceOff + 4; // 16
-    protected static final byte levelOff = totalFreeSpaceOff + 4;
-    protected static final byte smFlagOff = levelOff + 1;
+	protected static final int pageLsnOff = 0; // 0
+	protected static final int tupleCountOff = pageLsnOff + 4; // 4
+	protected static final int freeSpaceOff = tupleCountOff + 4; // 8
+	protected static final int totalFreeSpaceOff = freeSpaceOff + 4; // 16
+	protected static final byte levelOff = totalFreeSpaceOff + 4;
+	protected static final byte smFlagOff = levelOff + 1;
 
-    protected ICachedPage page = null;
-    protected ByteBuffer buf = null;
-    protected ISlotManager slotManager;
+	protected ICachedPage page = null;
+	protected ByteBuffer buf = null;
+	protected ISlotManager slotManager;
 
-    protected ITreeIndexTupleWriter tupleWriter;
-    protected ITreeIndexTupleReference frameTuple;
+	protected ITreeIndexTupleWriter tupleWriter;
+	protected ITreeIndexTupleReference frameTuple;
 
-    public TreeIndexNSMFrame(ITreeIndexTupleWriter tupleWriter, ISlotManager slotManager) {
-        this.tupleWriter = tupleWriter;
-        this.frameTuple = tupleWriter.createTupleReference();
-        this.slotManager = slotManager;
-    }
+	public TreeIndexNSMFrame(ITreeIndexTupleWriter tupleWriter,
+			ISlotManager slotManager) {
+		this.tupleWriter = tupleWriter;
+		this.frameTuple = tupleWriter.createTupleReference();
+		this.slotManager = slotManager;
+	}
 
-    @Override
-    public void initBuffer(byte level) {
-        buf.putInt(pageLsnOff, 0); // TODO: might to set to a different lsn
-        // during creation
-        buf.putInt(tupleCountOff, 0);
-        resetSpaceParams();
-        buf.put(levelOff, level);
-        buf.put(smFlagOff, (byte) 0);
-    }
+	@Override
+	public void initBuffer(byte level) {
+		buf.putInt(pageLsnOff, 0); // TODO: might to set to a different lsn
+		// during creation
+		buf.putInt(tupleCountOff, 0);
+		resetSpaceParams();
+		buf.put(levelOff, level);
+		buf.put(smFlagOff, (byte) 0);
+	}
 
-    @Override
-    public boolean isLeaf() {
-        return buf.get(levelOff) == 0;
-    }
+	@Override
+	public boolean isLeaf() {
+		return buf.get(levelOff) == 0;
+	}
 
-    @Override
-    public boolean isInterior() {
-        return buf.get(levelOff) > 0;
-    }
+	@Override
+	public boolean isInterior() {
+		return buf.get(levelOff) > 0;
+	}
 
-    @Override
-    public byte getLevel() {
-        return buf.get(levelOff);
-    }
+	@Override
+	public byte getLevel() {
+		return buf.get(levelOff);
+	}
 
-    @Override
-    public void setLevel(byte level) {
-        buf.put(levelOff, level);
-    }
+	@Override
+	public void setLevel(byte level) {
+		buf.put(levelOff, level);
+	}
 
-    @Override
-    public boolean getSmFlag() {
-        return buf.get(smFlagOff) != 0;
-    }
+	@Override
+	public boolean getSmFlag() {
+		return buf.get(smFlagOff) != 0;
+	}
 
-    @Override
-    public void setSmFlag(boolean smFlag) {
-        if (smFlag)
-            buf.put(smFlagOff, (byte) 1);
-        else
-            buf.put(smFlagOff, (byte) 0);
-    }
+	@Override
+	public void setSmFlag(boolean smFlag) {
+		if (smFlag)
+			buf.put(smFlagOff, (byte) 1);
+		else
+			buf.put(smFlagOff, (byte) 0);
+	}
 
-    @Override
-    public int getFreeSpaceOff() {
-        return buf.getInt(freeSpaceOff);
-    }
+	@Override
+	public int getFreeSpaceOff() {
+		return buf.getInt(freeSpaceOff);
+	}
 
-    @Override
-    public void setFreeSpaceOff(int freeSpace) {
-        buf.putInt(freeSpaceOff, freeSpace);
-    }
+	@Override
+	public void setFreeSpaceOff(int freeSpace) {
+		buf.putInt(freeSpaceOff, freeSpace);
+	}
 
-    @Override
-    public void setPage(ICachedPage page) {
-        this.page = page;
-        this.buf = page.getBuffer();
-        slotManager.setFrame(this);
-    }
+	@Override
+	public void setPage(ICachedPage page) {
+		this.page = page;
+		this.buf = page.getBuffer();
+		slotManager.setFrame(this);
+	}
 
-    @Override
-    public ByteBuffer getBuffer() {
-        return page.getBuffer();
-    }
+	@Override
+	public ByteBuffer getBuffer() {
+		return page.getBuffer();
+	}
 
-    @Override
-    public ICachedPage getPage() {
-        return page;
-    }
+	@Override
+	public ICachedPage getPage() {
+		return page;
+	}
 
-    @Override
-    public boolean compact(MultiComparator cmp) {
-        resetSpaceParams();
-        frameTuple.setFieldCount(cmp.getFieldCount());
+	@Override
+	public boolean compact(MultiComparator cmp) {
+		resetSpaceParams();
+		frameTuple.setFieldCount(cmp.getFieldCount());
 
-        int tupleCount = buf.getInt(tupleCountOff);
-        int freeSpace = buf.getInt(freeSpaceOff);
+		int tupleCount = buf.getInt(tupleCountOff);
+		int freeSpace = buf.getInt(freeSpaceOff);
 
-        ArrayList<SlotOffTupleOff> sortedTupleOffs = new ArrayList<SlotOffTupleOff>();
-        sortedTupleOffs.ensureCapacity(tupleCount);
-        for (int i = 0; i < tupleCount; i++) {
-            int slotOff = slotManager.getSlotOff(i);
-            int tupleOff = slotManager.getTupleOff(slotOff);
-            sortedTupleOffs.add(new SlotOffTupleOff(i, slotOff, tupleOff));
-        }
-        Collections.sort(sortedTupleOffs);
+		ArrayList<SlotOffTupleOff> sortedTupleOffs = new ArrayList<SlotOffTupleOff>();
+		sortedTupleOffs.ensureCapacity(tupleCount);
+		for (int i = 0; i < tupleCount; i++) {
+			int slotOff = slotManager.getSlotOff(i);
+			int tupleOff = slotManager.getTupleOff(slotOff);
+			sortedTupleOffs.add(new SlotOffTupleOff(i, slotOff, tupleOff));
+		}
+		Collections.sort(sortedTupleOffs);
 
-        for (int i = 0; i < sortedTupleOffs.size(); i++) {
-            int tupleOff = sortedTupleOffs.get(i).tupleOff;
-            frameTuple.resetByTupleOffset(buf, tupleOff);
+		for (int i = 0; i < sortedTupleOffs.size(); i++) {
+			int tupleOff = sortedTupleOffs.get(i).tupleOff;
+			frameTuple.resetByTupleOffset(buf, tupleOff);
 
-            int tupleEndOff = frameTuple.getFieldStart(frameTuple.getFieldCount() - 1)
-                    + frameTuple.getFieldLength(frameTuple.getFieldCount() - 1);
-            int tupleLength = tupleEndOff - tupleOff;
-            System.arraycopy(buf.array(), tupleOff, buf.array(), freeSpace, tupleLength);
+			int tupleEndOff = frameTuple.getFieldStart(frameTuple
+					.getFieldCount() - 1)
+					+ frameTuple.getFieldLength(frameTuple.getFieldCount() - 1);
+			int tupleLength = tupleEndOff - tupleOff;
+			System.arraycopy(buf.array(), tupleOff, buf.array(), freeSpace,
+					tupleLength);
 
-            slotManager.setSlot(sortedTupleOffs.get(i).slotOff, freeSpace);
-            freeSpace += tupleLength;
-        }
+			slotManager.setSlot(sortedTupleOffs.get(i).slotOff, freeSpace);
+			freeSpace += tupleLength;
+		}
 
-        buf.putInt(freeSpaceOff, freeSpace);
-        buf.putInt(totalFreeSpaceOff, buf.capacity() - freeSpace - tupleCount * slotManager.getSlotSize());
+		buf.putInt(freeSpaceOff, freeSpace);
+		buf.putInt(totalFreeSpaceOff, buf.capacity() - freeSpace - tupleCount
+				* slotManager.getSlotSize());
 
-        return false;
-    }
+		return false;
+	}
 
-    @Override
-    public void delete(ITupleReference tuple, MultiComparator cmp, boolean exactDelete) throws Exception {
+	@Override
+	public void delete(ITupleReference tuple, MultiComparator cmp,
+			boolean exactDelete) throws Exception {
 
-        frameTuple.setFieldCount(cmp.getFieldCount());
-        int tupleIndex = slotManager.findTupleIndex(tuple, frameTuple, cmp, FindTupleMode.FTM_EXACT,
-                FindTupleNoExactMatchPolicy.FTP_HIGHER_KEY);
-        int slotOff = slotManager.getSlotOff(tupleIndex);
-        if (tupleIndex < 0) {
-            throw new TreeIndexException("Key to be deleted does not exist.");
-        } else {
-            if (exactDelete) {
-                // check the non-key columns for equality by byte-by-byte
-                // comparison
-                int tupleOff = slotManager.getTupleOff(slotOff);
-                frameTuple.resetByTupleOffset(buf, tupleOff);
+		frameTuple.setFieldCount(cmp.getFieldCount());
+		int tupleIndex = slotManager.findTupleIndex(tuple, frameTuple, cmp,
+				FindTupleMode.FTM_EXACT,
+				FindTupleNoExactMatchPolicy.FTP_HIGHER_KEY);
+		int slotOff = slotManager.getSlotOff(tupleIndex);
+		if (tupleIndex < 0) {
+			throw new TreeIndexException("Key to be deleted does not exist.");
+		} else {
+			if (exactDelete) {
+				// check the non-key columns for equality by byte-by-byte
+				// comparison
+				int tupleOff = slotManager.getTupleOff(slotOff);
+				frameTuple.resetByTupleOffset(buf, tupleOff);
 
-                int comparison = cmp.fieldRangeCompare(tuple, frameTuple, cmp.getKeyFieldCount() - 1,
-                        cmp.getFieldCount() - cmp.getKeyFieldCount());
-                if (comparison != 0) {
-                    throw new TreeIndexException(
-                            "Cannot delete tuple. Byte-by-byte comparison failed to prove equality.");
-                }
-            }
+				int comparison = cmp.fieldRangeCompare(tuple, frameTuple,
+						cmp.getKeyFieldCount() - 1,
+						cmp.getFieldCount() - cmp.getKeyFieldCount());
+				if (comparison != 0) {
+					throw new TreeIndexException(
+							"Cannot delete tuple. Byte-by-byte comparison failed to prove equality.");
+				}
+			}
 
-            int tupleOff = slotManager.getTupleOff(slotOff);
-            frameTuple.resetByTupleOffset(buf, tupleOff);
-            int tupleSize = tupleWriter.bytesRequired(frameTuple);
+			int tupleOff = slotManager.getTupleOff(slotOff);
+			frameTuple.resetByTupleOffset(buf, tupleOff);
+			int tupleSize = tupleWriter.bytesRequired(frameTuple);
 
-            // perform deletion (we just do a memcpy to overwrite the slot)
-            int slotStartOff = slotManager.getSlotEndOff();
-            int length = slotOff - slotStartOff;
-            System.arraycopy(buf.array(), slotStartOff, buf.array(), slotStartOff + slotManager.getSlotSize(), length);
+			// perform deletion (we just do a memcpy to overwrite the slot)
+			int slotStartOff = slotManager.getSlotEndOff();
+			int length = slotOff - slotStartOff;
+			System.arraycopy(buf.array(), slotStartOff, buf.array(),
+					slotStartOff + slotManager.getSlotSize(), length);
 
-            // maintain space information
-            buf.putInt(tupleCountOff, buf.getInt(tupleCountOff) - 1);
-            buf.putInt(totalFreeSpaceOff, buf.getInt(totalFreeSpaceOff) + tupleSize + slotManager.getSlotSize());
-        }
-    }
+			// maintain space information
+			buf.putInt(tupleCountOff, buf.getInt(tupleCountOff) - 1);
+			buf.putInt(totalFreeSpaceOff, buf.getInt(totalFreeSpaceOff)
+					+ tupleSize + slotManager.getSlotSize());
+		}
+	}
 
-    @Override
-    public FrameOpSpaceStatus hasSpaceInsert(ITupleReference tuple, MultiComparator cmp) {
-        int bytesRequired = tupleWriter.bytesRequired(tuple);
-        if (bytesRequired + slotManager.getSlotSize() <= buf.capacity() - buf.getInt(freeSpaceOff)
-                - (buf.getInt(tupleCountOff) * slotManager.getSlotSize()))
-            return FrameOpSpaceStatus.SUFFICIENT_CONTIGUOUS_SPACE;
-        else if (bytesRequired + slotManager.getSlotSize() <= buf.getInt(totalFreeSpaceOff))
-            return FrameOpSpaceStatus.SUFFICIENT_SPACE;
-        else
-            return FrameOpSpaceStatus.INSUFFICIENT_SPACE;
-    }
+	@Override
+	public FrameOpSpaceStatus hasSpaceInsert(ITupleReference tuple,
+			MultiComparator cmp) {
+		int bytesRequired = tupleWriter.bytesRequired(tuple);
+		if (bytesRequired + slotManager.getSlotSize() <= buf.capacity()
+				- buf.getInt(freeSpaceOff)
+				- (buf.getInt(tupleCountOff) * slotManager.getSlotSize()))
+			return FrameOpSpaceStatus.SUFFICIENT_CONTIGUOUS_SPACE;
+		else if (bytesRequired + slotManager.getSlotSize() <= buf
+				.getInt(totalFreeSpaceOff))
+			return FrameOpSpaceStatus.SUFFICIENT_SPACE;
+		else
+			return FrameOpSpaceStatus.INSUFFICIENT_SPACE;
+	}
 
-    @Override
-    public FrameOpSpaceStatus hasSpaceUpdate(int rid, ITupleReference tuple, MultiComparator cmp) {
-        // TODO Auto-generated method stub
-        return FrameOpSpaceStatus.INSUFFICIENT_SPACE;
-    }
+	@Override
+	public FrameOpSpaceStatus hasSpaceUpdate(int rid, ITupleReference tuple,
+			MultiComparator cmp) {
+		// TODO Auto-generated method stub
+		return FrameOpSpaceStatus.INSUFFICIENT_SPACE;
+	}
 
-    protected void resetSpaceParams() {
-        buf.putInt(freeSpaceOff, smFlagOff + 1);
-        buf.putInt(totalFreeSpaceOff, buf.capacity() - (smFlagOff + 1));
-    }
+	protected void resetSpaceParams() {
+		buf.putInt(freeSpaceOff, smFlagOff + 1);
+		buf.putInt(totalFreeSpaceOff, buf.capacity() - (smFlagOff + 1));
+	}
 
-    @Override
-    public int findTupleIndex(ITupleReference tuple, MultiComparator cmp) throws Exception {
-        frameTuple.setFieldCount(cmp.getFieldCount());
-        return slotManager.findTupleIndex(tuple, frameTuple, cmp, FindTupleMode.FTM_INCLUSIVE,
-                FindTupleNoExactMatchPolicy.FTP_HIGHER_KEY);
-    }
+	@Override
+	public int findTupleIndex(ITupleReference tuple, MultiComparator cmp)
+			throws Exception {
+		frameTuple.setFieldCount(cmp.getFieldCount());
+		return slotManager.findTupleIndex(tuple, frameTuple, cmp,
+				FindTupleMode.FTM_INCLUSIVE,
+				FindTupleNoExactMatchPolicy.FTP_HIGHER_KEY);
+	}
 
-    @Override
-    public void insert(ITupleReference tuple, MultiComparator cmp, int tupleIndex) throws Exception {
-        slotManager.insertSlot(tupleIndex, buf.getInt(freeSpaceOff));
-        int bytesWritten = tupleWriter.writeTuple(tuple, buf, buf.getInt(freeSpaceOff));
-        buf.putInt(tupleCountOff, buf.getInt(tupleCountOff) + 1);
-        buf.putInt(freeSpaceOff, buf.getInt(freeSpaceOff) + bytesWritten);
-        buf.putInt(totalFreeSpaceOff, buf.getInt(totalFreeSpaceOff) - bytesWritten - slotManager.getSlotSize());
-    }
+	@Override
+	public void insert(ITupleReference tuple, MultiComparator cmp,
+			int tupleIndex) throws Exception {
+		slotManager.insertSlot(tupleIndex, buf.getInt(freeSpaceOff));
+		int bytesWritten = tupleWriter.writeTuple(tuple, buf,
+				buf.getInt(freeSpaceOff));
+		buf.putInt(tupleCountOff, buf.getInt(tupleCountOff) + 1);
+		buf.putInt(freeSpaceOff, buf.getInt(freeSpaceOff) + bytesWritten);
+		buf.putInt(totalFreeSpaceOff, buf.getInt(totalFreeSpaceOff)
+				- bytesWritten - slotManager.getSlotSize());
+	}
 
-    @Override
-    public void update(int rid, ITupleReference tuple) throws Exception {
-        // TODO Auto-generated method stub
+	@Override
+	public void update(int rid, ITupleReference tuple) throws Exception {
+		// TODO Auto-generated method stub
 
-    }
+	}
 
-    @Override
-    public void printHeader() {
-        // TODO Auto-generated method stub
+	@Override
+	public void printHeader() {
+		// TODO Auto-generated method stub
 
-    }
+	}
 
-    @Override
-    public int getTupleCount() {
-        return buf.getInt(tupleCountOff);
-    }
+	@Override
+	public int getTupleCount() {
+		return buf.getInt(tupleCountOff);
+	}
 
-    public ISlotManager getSlotManager() {
-        return slotManager;
-    }
+	public ISlotManager getSlotManager() {
+		return slotManager;
+	}
 
-    @Override
-    public String printKeys(MultiComparator cmp, ISerializerDeserializer[] fields) throws HyracksDataException {
-        StringBuilder strBuilder = new StringBuilder();
-        int tupleCount = buf.getInt(tupleCountOff);
-        frameTuple.setFieldCount(fields.length);
-        for (int i = 0; i < tupleCount; i++) {
-            frameTuple.resetByTupleIndex(this, i);
-            for (int j = 0; j < cmp.getKeyFieldCount(); j++) {
-                ByteArrayInputStream inStream = new ByteArrayInputStream(frameTuple.getFieldData(j),
-                        frameTuple.getFieldStart(j), frameTuple.getFieldLength(j));
-                DataInput dataIn = new DataInputStream(inStream);
-                Object o = fields[j].deserialize(dataIn);
-                strBuilder.append(o.toString() + " ");
-            }
-            strBuilder.append(" | ");
-        }
-        strBuilder.append("\n");
-        return strBuilder.toString();
-    }
+	@Override
+	public String printKeys(MultiComparator cmp,
+			ISerializerDeserializer[] fields) throws HyracksDataException {
+		StringBuilder strBuilder = new StringBuilder();
+		int tupleCount = buf.getInt(tupleCountOff);
+		frameTuple.setFieldCount(fields.length);
+		for (int i = 0; i < tupleCount; i++) {
+			frameTuple.resetByTupleIndex(this, i);
+			for (int j = 0; j < cmp.getKeyFieldCount(); j++) {
+				ByteArrayInputStream inStream = new ByteArrayInputStream(
+						frameTuple.getFieldData(j),
+						frameTuple.getFieldStart(j),
+						frameTuple.getFieldLength(j));
+				DataInput dataIn = new DataInputStream(inStream);
+				Object o = fields[j].deserialize(dataIn);
+				strBuilder.append(o.toString() + " ");
+			}
+			strBuilder.append(" | ");
+		}
+		strBuilder.append("\n");
+		return strBuilder.toString();
+	}
 
-    @Override
-    public int getTupleOffset(int slotNum) {
-        return slotManager.getTupleOff(slotManager.getSlotStartOff() - slotNum * slotManager.getSlotSize());
-    }
+	@Override
+	public int getTupleOffset(int slotNum) {
+		return slotManager.getTupleOff(slotManager.getSlotStartOff() - slotNum
+				* slotManager.getSlotSize());
+	}
 
-    @Override
-    public int getPageLsn() {
-        return buf.getInt(pageLsnOff);
-    }
+	@Override
+	public int getPageLsn() {
+		return buf.getInt(pageLsnOff);
+	}
 
-    @Override
-    public void setPageLsn(int pageLsn) {
-        buf.putInt(pageLsnOff, pageLsn);
-    }
+	@Override
+	public void setPageLsn(int pageLsn) {
+		buf.putInt(pageLsnOff, pageLsn);
+	}
 
-    @Override
-    public int getTotalFreeSpace() {
-        return buf.getInt(totalFreeSpaceOff);
-    }
+	@Override
+	public int getTotalFreeSpace() {
+		return buf.getInt(totalFreeSpaceOff);
+	}
 
-    @Override
-    public boolean compress(MultiComparator cmp) {
-        return false;
-    }
+	@Override
+	public boolean compress(MultiComparator cmp) {
+		return false;
+	}
 
-    @Override
-    public int getSlotSize() {
-        return slotManager.getSlotSize();
-    }
+	@Override
+	public int getSlotSize() {
+		return slotManager.getSlotSize();
+	}
 
-    @Override
-    public void setPageTupleFieldCount(int fieldCount) {
-        frameTuple.setFieldCount(fieldCount);
-    }
+	@Override
+	public void setPageTupleFieldCount(int fieldCount) {
+		frameTuple.setFieldCount(fieldCount);
+	}
 
-    public ITreeIndexTupleWriter getTupleWriter() {
-        return tupleWriter;
-    }
+	public ITreeIndexTupleWriter getTupleWriter() {
+		return tupleWriter;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/freepage/LinkedListFreePageManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/freepage/LinkedListFreePageManager.java
index 42bf70f..f7e2e3b 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/freepage/LinkedListFreePageManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/freepage/LinkedListFreePageManager.java
@@ -10,178 +10,193 @@
 
 public class LinkedListFreePageManager implements IFreePageManager {
 
-    private static final byte META_PAGE_LEVEL_INDICATOR = -1;
-    private static final byte FREE_PAGE_LEVEL_INDICATOR = -2;
-    private final IBufferCache bufferCache;
-    private final int fileId;
-    private final int headPage;
-    private final ITreeIndexMetaDataFrameFactory metaDataFrameFactory;
+	private static final byte META_PAGE_LEVEL_INDICATOR = -1;
+	private static final byte FREE_PAGE_LEVEL_INDICATOR = -2;
+	private final IBufferCache bufferCache;
+	private final int fileId;
+	private final int headPage;
+	private final ITreeIndexMetaDataFrameFactory metaDataFrameFactory;
 
-    public LinkedListFreePageManager(IBufferCache bufferCache, int fileId, int headPage,
-            ITreeIndexMetaDataFrameFactory metaDataFrameFactory) {
-        this.bufferCache = bufferCache;
-        this.fileId = fileId;
-        this.headPage = headPage;
-        this.metaDataFrameFactory = metaDataFrameFactory;
-    }
+	public LinkedListFreePageManager(IBufferCache bufferCache, int fileId,
+			int headPage, ITreeIndexMetaDataFrameFactory metaDataFrameFactory) {
+		this.bufferCache = bufferCache;
+		this.fileId = fileId;
+		this.headPage = headPage;
+		this.metaDataFrameFactory = metaDataFrameFactory;
+	}
 
-    @Override
-    public void addFreePage(ITreeIndexMetaDataFrame metaFrame, int freePage) throws HyracksDataException {
+	@Override
+	public void addFreePage(ITreeIndexMetaDataFrame metaFrame, int freePage)
+			throws HyracksDataException {
 
-        ICachedPage metaNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, headPage), false);
-        metaNode.acquireWriteLatch();
+		ICachedPage metaNode = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, headPage), false);
+		metaNode.acquireWriteLatch();
 
-        try {
-            metaFrame.setPage(metaNode);
+		try {
+			metaFrame.setPage(metaNode);
 
-            if (metaFrame.hasSpace()) {
-                metaFrame.addFreePage(freePage);
-            } else {
-                // allocate a new page in the chain of meta pages
-                int newPage = metaFrame.getFreePage();
-                if (newPage < 0) {
-                    throw new Exception("Inconsistent Meta Page State. It has no space, but it also has no entries.");
-                }
+			if (metaFrame.hasSpace()) {
+				metaFrame.addFreePage(freePage);
+			} else {
+				// allocate a new page in the chain of meta pages
+				int newPage = metaFrame.getFreePage();
+				if (newPage < 0) {
+					throw new Exception(
+							"Inconsistent Meta Page State. It has no space, but it also has no entries.");
+				}
 
-                ICachedPage newNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, newPage), false);
-                newNode.acquireWriteLatch();
+				ICachedPage newNode = bufferCache.pin(
+						BufferedFileHandle.getDiskPageId(fileId, newPage),
+						false);
+				newNode.acquireWriteLatch();
 
-                try {
-                    int metaMaxPage = metaFrame.getMaxPage();
+				try {
+					int metaMaxPage = metaFrame.getMaxPage();
 
-                    // copy metaDataPage to newNode
-                    System.arraycopy(metaNode.getBuffer().array(), 0, newNode.getBuffer().array(), 0, metaNode
-                            .getBuffer().capacity());
+					// copy metaDataPage to newNode
+					System.arraycopy(metaNode.getBuffer().array(), 0, newNode
+							.getBuffer().array(), 0, metaNode.getBuffer()
+							.capacity());
 
-                    metaFrame.initBuffer(META_PAGE_LEVEL_INDICATOR);
-                    metaFrame.setNextPage(newPage);
-                    metaFrame.setMaxPage(metaMaxPage);
-                    metaFrame.addFreePage(freePage);
-                } finally {
-                    newNode.releaseWriteLatch();
-                    bufferCache.unpin(newNode);
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            metaNode.releaseWriteLatch();
-            bufferCache.unpin(metaNode);
-        }
-    }
+					metaFrame.initBuffer(META_PAGE_LEVEL_INDICATOR);
+					metaFrame.setNextPage(newPage);
+					metaFrame.setMaxPage(metaMaxPage);
+					metaFrame.addFreePage(freePage);
+				} finally {
+					newNode.releaseWriteLatch();
+					bufferCache.unpin(newNode);
+				}
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			metaNode.releaseWriteLatch();
+			bufferCache.unpin(metaNode);
+		}
+	}
 
-    @Override
-    public int getFreePage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
-        ICachedPage metaNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, headPage), false);
+	@Override
+	public int getFreePage(ITreeIndexMetaDataFrame metaFrame)
+			throws HyracksDataException {
+		ICachedPage metaNode = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, headPage), false);
 
-        metaNode.acquireWriteLatch();
+		metaNode.acquireWriteLatch();
 
-        int freePage = -1;
-        try {
-            metaFrame.setPage(metaNode);
-            freePage = metaFrame.getFreePage();
-            if (freePage < 0) { // no free page entry on this page
-                int nextPage = metaFrame.getNextPage();
-                if (nextPage > 0) { // sibling may have free pages
-                    ICachedPage nextNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, nextPage), false);
+		int freePage = -1;
+		try {
+			metaFrame.setPage(metaNode);
+			freePage = metaFrame.getFreePage();
+			if (freePage < 0) { // no free page entry on this page
+				int nextPage = metaFrame.getNextPage();
+				if (nextPage > 0) { // sibling may have free pages
+					ICachedPage nextNode = bufferCache.pin(
+							BufferedFileHandle.getDiskPageId(fileId, nextPage),
+							false);
 
-                    nextNode.acquireWriteLatch();
-                    // we copy over the free space entries of nextpage into the
-                    // first meta page (metaDataPage)
-                    // we need to link the first page properly to the next page
-                    // of nextpage
-                    try {
-                        // remember entries that remain unchanged
-                        int maxPage = metaFrame.getMaxPage();
+					nextNode.acquireWriteLatch();
+					// we copy over the free space entries of nextpage into the
+					// first meta page (metaDataPage)
+					// we need to link the first page properly to the next page
+					// of nextpage
+					try {
+						// remember entries that remain unchanged
+						int maxPage = metaFrame.getMaxPage();
 
-                        // copy entire page (including sibling pointer, free
-                        // page entries, and all other info)
-                        // after this copy nextPage is considered a free page
-                        System.arraycopy(nextNode.getBuffer().array(), 0, metaNode.getBuffer().array(), 0, nextNode
-                                .getBuffer().capacity());
+						// copy entire page (including sibling pointer, free
+						// page entries, and all other info)
+						// after this copy nextPage is considered a free page
+						System.arraycopy(nextNode.getBuffer().array(), 0,
+								metaNode.getBuffer().array(), 0, nextNode
+										.getBuffer().capacity());
 
-                        // reset unchanged entry
-                        metaFrame.setMaxPage(maxPage);
+						// reset unchanged entry
+						metaFrame.setMaxPage(maxPage);
 
-                        freePage = metaFrame.getFreePage();
-                        // sibling also has no free pages, this "should" not
-                        // happen, but we deal with it anyway just to be safe
-                        if (freePage < 0) {
-                            freePage = nextPage;
-                        } else {
-                            metaFrame.addFreePage(nextPage);
-                        }
-                    } finally {
-                        nextNode.releaseWriteLatch();
-                        bufferCache.unpin(nextNode);
-                    }
-                } else {
-                    freePage = metaFrame.getMaxPage();
-                    freePage++;
-                    metaFrame.setMaxPage(freePage);
-                }
-            }
-        } finally {
-            metaNode.releaseWriteLatch();
-            bufferCache.unpin(metaNode);
-        }
+						freePage = metaFrame.getFreePage();
+						// sibling also has no free pages, this "should" not
+						// happen, but we deal with it anyway just to be safe
+						if (freePage < 0) {
+							freePage = nextPage;
+						} else {
+							metaFrame.addFreePage(nextPage);
+						}
+					} finally {
+						nextNode.releaseWriteLatch();
+						bufferCache.unpin(nextNode);
+					}
+				} else {
+					freePage = metaFrame.getMaxPage();
+					freePage++;
+					metaFrame.setMaxPage(freePage);
+				}
+			}
+		} finally {
+			metaNode.releaseWriteLatch();
+			bufferCache.unpin(metaNode);
+		}
 
-        return freePage;
-    }
+		return freePage;
+	}
 
-    @Override
-    public int getMaxPage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
-        ICachedPage metaNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, headPage), false);
-        metaNode.acquireWriteLatch();
-        int maxPage = -1;
-        try {
-            metaFrame.setPage(metaNode);
-            maxPage = metaFrame.getMaxPage();
-        } finally {
-            metaNode.releaseWriteLatch();
-            bufferCache.unpin(metaNode);
-        }
-        return maxPage;
-    }
+	@Override
+	public int getMaxPage(ITreeIndexMetaDataFrame metaFrame)
+			throws HyracksDataException {
+		ICachedPage metaNode = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, headPage), false);
+		metaNode.acquireWriteLatch();
+		int maxPage = -1;
+		try {
+			metaFrame.setPage(metaNode);
+			maxPage = metaFrame.getMaxPage();
+		} finally {
+			metaNode.releaseWriteLatch();
+			bufferCache.unpin(metaNode);
+		}
+		return maxPage;
+	}
 
-    @Override
-    public void init(ITreeIndexMetaDataFrame metaFrame, int currentMaxPage) throws HyracksDataException {
-        // initialize meta data page
-        ICachedPage metaNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, headPage), true);
+	@Override
+	public void init(ITreeIndexMetaDataFrame metaFrame, int currentMaxPage)
+			throws HyracksDataException {
+		// initialize meta data page
+		ICachedPage metaNode = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, headPage), true);
 
-        metaNode.acquireWriteLatch();
-        try {
-            metaFrame.setPage(metaNode);
-            metaFrame.initBuffer(META_PAGE_LEVEL_INDICATOR);
-            metaFrame.setMaxPage(currentMaxPage);
-        } finally {
-            metaNode.releaseWriteLatch();
-            bufferCache.unpin(metaNode);
-        }
-    }
+		metaNode.acquireWriteLatch();
+		try {
+			metaFrame.setPage(metaNode);
+			metaFrame.initBuffer(META_PAGE_LEVEL_INDICATOR);
+			metaFrame.setMaxPage(currentMaxPage);
+		} finally {
+			metaNode.releaseWriteLatch();
+			bufferCache.unpin(metaNode);
+		}
+	}
 
-    @Override
-    public ITreeIndexMetaDataFrameFactory getMetaDataFrameFactory() {
-        return metaDataFrameFactory;
-    }
+	@Override
+	public ITreeIndexMetaDataFrameFactory getMetaDataFrameFactory() {
+		return metaDataFrameFactory;
+	}
 
-    @Override
-    public byte getFreePageLevelIndicator() {
-        return FREE_PAGE_LEVEL_INDICATOR;
-    }
+	@Override
+	public byte getFreePageLevelIndicator() {
+		return FREE_PAGE_LEVEL_INDICATOR;
+	}
 
-    @Override
-    public byte getMetaPageLevelIndicator() {
-        return META_PAGE_LEVEL_INDICATOR;
-    }
+	@Override
+	public byte getMetaPageLevelIndicator() {
+		return META_PAGE_LEVEL_INDICATOR;
+	}
 
-    @Override
-    public boolean isFreePage(ITreeIndexMetaDataFrame metaFrame) {
-        return metaFrame.getLevel() == FREE_PAGE_LEVEL_INDICATOR;
-    }
+	@Override
+	public boolean isFreePage(ITreeIndexMetaDataFrame metaFrame) {
+		return metaFrame.getLevel() == FREE_PAGE_LEVEL_INDICATOR;
+	}
 
-    @Override
-    public boolean isMetaPage(ITreeIndexMetaDataFrame metaFrame) {
-        return metaFrame.getLevel() == META_PAGE_LEVEL_INDICATOR;
-    }
+	@Override
+	public boolean isMetaPage(ITreeIndexMetaDataFrame metaFrame) {
+		return metaFrame.getLevel() == META_PAGE_LEVEL_INDICATOR;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/TreeDiskOrderScanCursor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/TreeDiskOrderScanCursor.java
index 2c2cb5e..01b91b1 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/TreeDiskOrderScanCursor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/TreeDiskOrderScanCursor.java
@@ -28,123 +28,128 @@
 
 public class TreeDiskOrderScanCursor implements ITreeIndexCursor {
 
-    private int tupleIndex = 0;
-    private int fileId = -1;
-    int currentPageId = -1;
-    int maxPageId = -1;
-    private ICachedPage page = null;
-    private ITreeIndexFrame frame = null;
-    private IBufferCache bufferCache = null;
+	private int tupleIndex = 0;
+	private int fileId = -1;
+	int currentPageId = -1;
+	int maxPageId = -1;
+	private ICachedPage page = null;
+	private ITreeIndexFrame frame = null;
+	private IBufferCache bufferCache = null;
 
-    private ITreeIndexTupleReference frameTuple;
+	private ITreeIndexTupleReference frameTuple;
 
-    public TreeDiskOrderScanCursor(ITreeIndexFrame frame) {
-        this.frame = frame;
-        this.frameTuple = frame.getTupleWriter().createTupleReference();
-    }
+	public TreeDiskOrderScanCursor(ITreeIndexFrame frame) {
+		this.frame = frame;
+		this.frameTuple = frame.getTupleWriter().createTupleReference();
+	}
 
-    @Override
-    public void close() throws Exception {
-        page.releaseReadLatch();
-        bufferCache.unpin(page);
-        page = null;
-    }
+	@Override
+	public void close() throws Exception {
+		page.releaseReadLatch();
+		bufferCache.unpin(page);
+		page = null;
+	}
 
-    @Override
-    public ITreeIndexTupleReference getTuple() {
-        return frameTuple;
-    }
+	@Override
+	public ITreeIndexTupleReference getTuple() {
+		return frameTuple;
+	}
 
-    @Override
-    public ICachedPage getPage() {
-        return page;
-    }
+	@Override
+	public ICachedPage getPage() {
+		return page;
+	}
 
-    private boolean positionToNextLeaf(boolean skipCurrent) throws HyracksDataException {
-        while ((frame.getLevel() != 0 || skipCurrent) && (currentPageId <= maxPageId) || (frame.getTupleCount() == 0)) {
-            currentPageId++;
+	private boolean positionToNextLeaf(boolean skipCurrent)
+			throws HyracksDataException {
+		while ((frame.getLevel() != 0 || skipCurrent)
+				&& (currentPageId <= maxPageId) || (frame.getTupleCount() == 0)) {
+			currentPageId++;
 
-            ICachedPage nextPage = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, currentPageId), false);
-            nextPage.acquireReadLatch();
+			ICachedPage nextPage = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, currentPageId),
+					false);
+			nextPage.acquireReadLatch();
 
-            page.releaseReadLatch();
-            bufferCache.unpin(page);
+			page.releaseReadLatch();
+			bufferCache.unpin(page);
 
-            page = nextPage;
-            frame.setPage(page);
-            tupleIndex = 0;
-            skipCurrent = false;
-        }
-        if (currentPageId <= maxPageId)
-            return true;
-        else
-            return false;
-    }
+			page = nextPage;
+			frame.setPage(page);
+			tupleIndex = 0;
+			skipCurrent = false;
+		}
+		if (currentPageId <= maxPageId)
+			return true;
+		else
+			return false;
+	}
 
-    @Override
-    public boolean hasNext() throws Exception {
-        if (tupleIndex >= frame.getTupleCount()) {
-            boolean nextLeafExists = positionToNextLeaf(true);
-            if (nextLeafExists) {
-                frameTuple.resetByTupleIndex(frame, tupleIndex);
-                return true;
-            } else {
-                return false;
-            }
-        }
+	@Override
+	public boolean hasNext() throws Exception {
+		if (tupleIndex >= frame.getTupleCount()) {
+			boolean nextLeafExists = positionToNextLeaf(true);
+			if (nextLeafExists) {
+				frameTuple.resetByTupleIndex(frame, tupleIndex);
+				return true;
+			} else {
+				return false;
+			}
+		}
 
-        frameTuple.resetByTupleIndex(frame, tupleIndex);
-        return true;
-    }
+		frameTuple.resetByTupleIndex(frame, tupleIndex);
+		return true;
+	}
 
-    @Override
-    public void next() throws Exception {
-        tupleIndex++;
-    }
+	@Override
+	public void next() throws Exception {
+		tupleIndex++;
+	}
 
-    @Override
-    public void open(ICursorInitialState initialState, ISearchPredicate searchPred) throws HyracksDataException {
-        // in case open is called multiple times without closing
-        if (page != null) {
-            page.releaseReadLatch();
-            bufferCache.unpin(page);
-        }
+	@Override
+	public void open(ICursorInitialState initialState,
+			ISearchPredicate searchPred) throws HyracksDataException {
+		// in case open is called multiple times without closing
+		if (page != null) {
+			page.releaseReadLatch();
+			bufferCache.unpin(page);
+		}
 
-        page = initialState.getPage();
-        tupleIndex = 0;
-        frame.setPage(page);
-        MultiComparator lowKeyCmp = searchPred.getLowKeyComparator();
-        frameTuple.setFieldCount(lowKeyCmp.getFieldCount());
-        boolean leafExists = positionToNextLeaf(false);
-        if (!leafExists) {
-            throw new HyracksDataException(
-                    "Failed to open disk-order scan cursor for tree index. Traget tree index has no leaves.");
-        }
-    }
+		page = initialState.getPage();
+		tupleIndex = 0;
+		frame.setPage(page);
+		MultiComparator lowKeyCmp = searchPred.getLowKeyComparator();
+		frameTuple.setFieldCount(lowKeyCmp.getFieldCount());
+		boolean leafExists = positionToNextLeaf(false);
+		if (!leafExists) {
+			throw new HyracksDataException(
+					"Failed to open disk-order scan cursor for tree index. Traget tree index has no leaves.");
+		}
+	}
 
-    @Override
-    public void reset() {
-        tupleIndex = 0;
-        currentPageId = -1;
-        maxPageId = -1;
-        page = null;
-    }
+	@Override
+	public void reset() {
+		tupleIndex = 0;
+		currentPageId = -1;
+		maxPageId = -1;
+		page = null;
+	}
 
-    @Override
-    public void setBufferCache(IBufferCache bufferCache) {
-        this.bufferCache = bufferCache;
-    }
+	@Override
+	public void setBufferCache(IBufferCache bufferCache) {
+		this.bufferCache = bufferCache;
+	}
 
-    @Override
-    public void setFileId(int fileId) {
-        this.fileId = fileId;
-    }
+	@Override
+	public void setFileId(int fileId) {
+		this.fileId = fileId;
+	}
 
-    public void setCurrentPageId(int currentPageId) {
-        this.currentPageId = currentPageId;
-    }
+	public void setCurrentPageId(int currentPageId) {
+		this.currentPageId = currentPageId;
+	}
 
-    public void setMaxPageId(int maxPageId) {
-        this.maxPageId = maxPageId;
-    }
+	public void setMaxPageId(int maxPageId) {
+		this.maxPageId = maxPageId;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleMode.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleMode.java
index cea2500..11ac257 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleMode.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleMode.java
@@ -16,5 +16,5 @@
 package edu.uci.ics.hyracks.storage.am.common.ophelpers;
 
 public enum FindTupleMode {
-    FTM_INCLUSIVE, FTM_EXCLUSIVE, FTM_EXACT
+	FTM_INCLUSIVE, FTM_EXCLUSIVE, FTM_EXACT
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleNoExactMatchPolicy.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleNoExactMatchPolicy.java
index 0d534ed..b8f3c9a 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleNoExactMatchPolicy.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/FindTupleNoExactMatchPolicy.java
@@ -16,5 +16,5 @@
 package edu.uci.ics.hyracks.storage.am.common.ophelpers;
 
 public enum FindTupleNoExactMatchPolicy {
-    FTP_LOWER_KEY, FTP_HIGHER_KEY
+	FTP_LOWER_KEY, FTP_HIGHER_KEY
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOp.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOp.java
index e40c5c8..780acd8 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOp.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOp.java
@@ -16,5 +16,5 @@
 package edu.uci.ics.hyracks.storage.am.common.ophelpers;
 
 public enum IndexOp {
-    INSERT, DELETE, UPDATE, SEARCH, DISKORDERSCAN
+	INSERT, DELETE, UPDATE, SEARCH, DISKORDERSCAN
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOpContext.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOpContext.java
index 4f6e656..9122174 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOpContext.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IndexOpContext.java
@@ -1,5 +1,5 @@
 package edu.uci.ics.hyracks.storage.am.common.ophelpers;
 
 public interface IndexOpContext {
-    void reset();
+	void reset();
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IntArrayList.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IntArrayList.java
index 46551dd..d888aa0 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IntArrayList.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/IntArrayList.java
@@ -16,74 +16,74 @@
 package edu.uci.ics.hyracks.storage.am.common.ophelpers;
 
 public class IntArrayList {
-    private int[] data;
-    private int size;
-    private int first;
-    private final int growth;
+	private int[] data;
+	private int size;
+	private int first;
+	private final int growth;
 
-    public IntArrayList(int initialCapacity, int growth) {
-        data = new int[initialCapacity];
-        size = 0;
-        first = 0;
-        this.growth = growth;
-    }
+	public IntArrayList(int initialCapacity, int growth) {
+		data = new int[initialCapacity];
+		size = 0;
+		first = 0;
+		this.growth = growth;
+	}
 
-    public int size() {
-        return size;
-    }
+	public int size() {
+		return size;
+	}
 
-    public int first() {
-        return first;
-    }
+	public int first() {
+		return first;
+	}
 
-    public void add(int i) {
-        if (size == data.length) {
-            int[] newData = new int[data.length + growth];
-            System.arraycopy(data, 0, newData, 0, data.length);
-            data = newData;
-        }
+	public void add(int i) {
+		if (size == data.length) {
+			int[] newData = new int[data.length + growth];
+			System.arraycopy(data, 0, newData, 0, data.length);
+			data = newData;
+		}
 
-        data[size++] = i;
-    }
+		data[size++] = i;
+	}
 
-    public void removeLast() {
-        if (size > 0)
-            size--;
-    }
+	public void removeLast() {
+		if (size > 0)
+			size--;
+	}
 
-    // WARNING: caller is responsible for checking size > 0
-    public int getLast() {
-        return data[size - 1];
-    }
+	// WARNING: caller is responsible for checking size > 0
+	public int getLast() {
+		return data[size - 1];
+	}
 
-    public int get(int i) {
-        return data[i];
-    }
+	public int get(int i) {
+		return data[i];
+	}
 
-    // WARNING: caller is responsible for checking i < size
-    public void set(int i, int value) {
-        data[i] = value;
+	// WARNING: caller is responsible for checking i < size
+	public void set(int i, int value) {
+		data[i] = value;
 
-    }
+	}
 
-    public int getFirst() {
-        return data[first];
-    }
+	public int getFirst() {
+		return data[first];
+	}
 
-    public void moveFirst() {
-        first++;
-    }
+	public void moveFirst() {
+		first++;
+	}
 
-    public void clear() {
-        size = 0;
-        first = 0;
-    }
+	public void clear() {
+		size = 0;
+		first = 0;
+	}
 
-    public boolean isLast() {
-        return size == first;
-    }
+	public boolean isLast() {
+		return size == first;
+	}
 
-    public boolean isEmpty() {
-        return size == 0;
-    }
+	public boolean isEmpty() {
+		return size == 0;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/MultiComparator.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/MultiComparator.java
index 1842bf8..a07ef03 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/MultiComparator.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/MultiComparator.java
@@ -25,78 +25,100 @@
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
 import edu.uci.ics.hyracks.dataflow.common.data.comparators.IntegerBinaryComparatorFactory;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
 
 public class MultiComparator {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    private IBinaryComparator[] cmps = null;
-    private ITypeTrait[] typeTraits;
+	private IBinaryComparator[] cmps = null;
+	private ITypeTrait[] typeTraits;
+	private IPrimitiveValueProvider[] valueProviders = null;
 
-    private IBinaryComparator intCmp = IntegerBinaryComparatorFactory.INSTANCE.createBinaryComparator();
+	private IBinaryComparator intCmp = IntegerBinaryComparatorFactory.INSTANCE
+			.createBinaryComparator();
 
-    public IBinaryComparator getIntCmp() {
-        return intCmp;
-    }
+	public IBinaryComparator getIntCmp() {
+		return intCmp;
+	}
 
-    public MultiComparator(ITypeTrait[] typeTraits, IBinaryComparator[] cmps) {
-        this.typeTraits = typeTraits;
-        this.cmps = cmps;
-    }
+	public MultiComparator(ITypeTrait[] typeTraits, IBinaryComparator[] cmps) {
+		this.typeTraits = typeTraits;
+		this.cmps = cmps;
+	}
 
-    public int compare(ITupleReference tupleA, ITupleReference tupleB) {
-        for (int i = 0; i < cmps.length; i++) {
-            int cmp = cmps[i].compare(tupleA.getFieldData(i), tupleA.getFieldStart(i), tupleA.getFieldLength(i),
-                    tupleB.getFieldData(i), tupleB.getFieldStart(i), tupleB.getFieldLength(i));
-            if (cmp < 0)
-                return -1;
-            else if (cmp > 0)
-                return 1;
-        }
-        return 0;
-    }
+	public MultiComparator(ITypeTrait[] typeTraits, IBinaryComparator[] cmps,
+			IPrimitiveValueProvider[] valueProviders) {
+		this.typeTraits = typeTraits;
+		this.cmps = cmps;
+		this.valueProviders = valueProviders;
+	}
 
-    public int fieldRangeCompare(ITupleReference tupleA, ITupleReference tupleB, int startFieldIndex, int numFields) {
-        for (int i = startFieldIndex; i < startFieldIndex + numFields; i++) {
-            int cmp = cmps[i].compare(tupleA.getFieldData(i), tupleA.getFieldStart(i), tupleA.getFieldLength(i),
-                    tupleB.getFieldData(i), tupleB.getFieldStart(i), tupleB.getFieldLength(i));
-            if (cmp < 0)
-                return -1;
-            else if (cmp > 0)
-                return 1;
-        }
-        return 0;
-    }
+	public int compare(ITupleReference tupleA, ITupleReference tupleB) {
+		for (int i = 0; i < cmps.length; i++) {
+			int cmp = cmps[i].compare(tupleA.getFieldData(i),
+					tupleA.getFieldStart(i), tupleA.getFieldLength(i),
+					tupleB.getFieldData(i), tupleB.getFieldStart(i),
+					tupleB.getFieldLength(i));
+			if (cmp < 0)
+				return -1;
+			else if (cmp > 0)
+				return 1;
+		}
+		return 0;
+	}
 
-    public String printTuple(ITupleReference tuple, ISerializerDeserializer[] fields) throws HyracksDataException {
-        StringBuilder strBuilder = new StringBuilder();
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            ByteArrayInputStream inStream = new ByteArrayInputStream(tuple.getFieldData(i), tuple.getFieldStart(i),
-                    tuple.getFieldLength(i));
-            DataInput dataIn = new DataInputStream(inStream);
-            Object o = fields[i].deserialize(dataIn);
-            strBuilder.append(o.toString() + " ");
-        }
-        return strBuilder.toString();
-    }
+	public int fieldRangeCompare(ITupleReference tupleA,
+			ITupleReference tupleB, int startFieldIndex, int numFields) {
+		for (int i = startFieldIndex; i < startFieldIndex + numFields; i++) {
+			int cmp = cmps[i].compare(tupleA.getFieldData(i),
+					tupleA.getFieldStart(i), tupleA.getFieldLength(i),
+					tupleB.getFieldData(i), tupleB.getFieldStart(i),
+					tupleB.getFieldLength(i));
+			if (cmp < 0)
+				return -1;
+			else if (cmp > 0)
+				return 1;
+		}
+		return 0;
+	}
 
-    public IBinaryComparator[] getComparators() {
-        return cmps;
-    }
+	public String printTuple(ITupleReference tuple,
+			ISerializerDeserializer[] fields) throws HyracksDataException {
+		StringBuilder strBuilder = new StringBuilder();
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			ByteArrayInputStream inStream = new ByteArrayInputStream(
+					tuple.getFieldData(i), tuple.getFieldStart(i),
+					tuple.getFieldLength(i));
+			DataInput dataIn = new DataInputStream(inStream);
+			Object o = fields[i].deserialize(dataIn);
+			strBuilder.append(o.toString() + " ");
+		}
+		return strBuilder.toString();
+	}
 
-    public int getKeyFieldCount() {
-        return cmps.length;
-    }
+	public IBinaryComparator[] getComparators() {
+		return cmps;
+	}
 
-    public void setComparators(IBinaryComparator[] cmps) {
-        this.cmps = cmps;
-    }
+	public int getKeyFieldCount() {
+		return cmps.length;
+	}
 
-    public int getFieldCount() {
-        return typeTraits.length;
-    }
+	public void setComparators(IBinaryComparator[] cmps) {
+		this.cmps = cmps;
+	}
 
-    public ITypeTrait[] getTypeTraits() {
-        return typeTraits;
-    }
-}
+	public int getFieldCount() {
+		return typeTraits.length;
+	}
+
+	public ITypeTrait[] getTypeTraits() {
+		return typeTraits;
+	}
+
+	public IPrimitiveValueProvider[] getValueProviders() {
+		return valueProviders;
+	}
+
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/SlotOffTupleOff.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/SlotOffTupleOff.java
index 4fc1861..35231c2 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/SlotOffTupleOff.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/ophelpers/SlotOffTupleOff.java
@@ -16,18 +16,18 @@
 package edu.uci.ics.hyracks.storage.am.common.ophelpers;
 
 public class SlotOffTupleOff implements Comparable<SlotOffTupleOff> {
-    public int tupleIndex;
-    public int slotOff;
-    public int tupleOff;
+	public int tupleIndex;
+	public int slotOff;
+	public int tupleOff;
 
-    public SlotOffTupleOff(int tupleIndex, int slotOff, int recOff) {
-        this.tupleIndex = tupleIndex;
-        this.slotOff = slotOff;
-        this.tupleOff = recOff;
-    }
+	public SlotOffTupleOff(int tupleIndex, int slotOff, int recOff) {
+		this.tupleIndex = tupleIndex;
+		this.slotOff = slotOff;
+		this.tupleOff = recOff;
+	}
 
-    @Override
-    public int compareTo(SlotOffTupleOff o) {
-        return tupleOff - o.tupleOff;
-    }
+	@Override
+	public int compareTo(SlotOffTupleOff o) {
+		return tupleOff - o.tupleOff;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleReference.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleReference.java
index f9e00ac..353bd95 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleReference.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleReference.java
@@ -22,73 +22,77 @@
 
 public class SimpleTupleReference implements ITreeIndexTupleReference {
 
-    protected ByteBuffer buf;
-    protected int fieldStartIndex;
-    protected int fieldCount;
-    protected int tupleStartOff;
-    protected int nullFlagsBytes;
-    protected int fieldSlotsBytes;
+	protected ByteBuffer buf;
+	protected int fieldStartIndex;
+	protected int fieldCount;
+	protected int tupleStartOff;
+	protected int nullFlagsBytes;
+	protected int fieldSlotsBytes;
 
-    @Override
-    public void resetByTupleOffset(ByteBuffer buf, int tupleStartOff) {
-        this.buf = buf;
-        this.tupleStartOff = tupleStartOff;
-    }
+	@Override
+	public void resetByTupleOffset(ByteBuffer buf, int tupleStartOff) {
+		this.buf = buf;
+		this.tupleStartOff = tupleStartOff;
+	}
 
-    @Override
-    public void resetByTupleIndex(ITreeIndexFrame frame, int tupleIndex) {
-        resetByTupleOffset(frame.getBuffer(), frame.getTupleOffset(tupleIndex));
-    }
+	@Override
+	public void resetByTupleIndex(ITreeIndexFrame frame, int tupleIndex) {
+		resetByTupleOffset(frame.getBuffer(), frame.getTupleOffset(tupleIndex));
+	}
 
-    @Override
-    public void setFieldCount(int fieldCount) {
-        this.fieldCount = fieldCount;
-        nullFlagsBytes = getNullFlagsBytes();
-        fieldSlotsBytes = getFieldSlotsBytes();
-        fieldStartIndex = 0;
-    }
+	@Override
+	public void setFieldCount(int fieldCount) {
+		this.fieldCount = fieldCount;
+		nullFlagsBytes = getNullFlagsBytes();
+		fieldSlotsBytes = getFieldSlotsBytes();
+		fieldStartIndex = 0;
+	}
 
-    @Override
-    public void setFieldCount(int fieldStartIndex, int fieldCount) {
-        this.fieldCount = fieldCount;
-        this.fieldStartIndex = fieldStartIndex;
-    }
+	@Override
+	public void setFieldCount(int fieldStartIndex, int fieldCount) {
+		this.fieldCount = fieldCount;
+		this.fieldStartIndex = fieldStartIndex;
+	}
 
-    @Override
-    public int getFieldCount() {
-        return fieldCount;
-    }
+	@Override
+	public int getFieldCount() {
+		return fieldCount;
+	}
 
-    @Override
-    public byte[] getFieldData(int fIdx) {
-        return buf.array();
-    }
+	@Override
+	public byte[] getFieldData(int fIdx) {
+		return buf.array();
+	}
 
-    @Override
-    public int getFieldLength(int fIdx) {
-        if (fIdx == 0) {
-            return buf.getShort(tupleStartOff + nullFlagsBytes);
-        } else {
-            return buf.getShort(tupleStartOff + nullFlagsBytes + fIdx * 2)
-                    - buf.getShort(tupleStartOff + nullFlagsBytes + ((fIdx - 1) * 2));
-        }
-    }
+	@Override
+	public int getFieldLength(int fIdx) {
+		if (fIdx == 0) {
+			return buf.getShort(tupleStartOff + nullFlagsBytes);
+		} else {
+			return buf.getShort(tupleStartOff + nullFlagsBytes + fIdx * 2)
+					- buf.getShort(tupleStartOff + nullFlagsBytes
+							+ ((fIdx - 1) * 2));
+		}
+	}
 
-    @Override
-    public int getFieldStart(int fIdx) {
-        if (fIdx == 0) {
-            return tupleStartOff + nullFlagsBytes + fieldSlotsBytes;
-        } else {
-            return tupleStartOff + nullFlagsBytes + fieldSlotsBytes
-                    + buf.getShort(tupleStartOff + nullFlagsBytes + ((fIdx - 1) * 2));
-        }
-    }
+	@Override
+	public int getFieldStart(int fIdx) {
+		if (fIdx == 0) {
+			return tupleStartOff + nullFlagsBytes + fieldSlotsBytes;
+		} else {
+			return tupleStartOff
+					+ nullFlagsBytes
+					+ fieldSlotsBytes
+					+ buf.getShort(tupleStartOff + nullFlagsBytes
+							+ ((fIdx - 1) * 2));
+		}
+	}
 
-    protected int getNullFlagsBytes() {
-        return (int) Math.ceil(fieldCount / 8.0);
-    }
+	protected int getNullFlagsBytes() {
+		return (int) Math.ceil(fieldCount / 8.0);
+	}
 
-    protected int getFieldSlotsBytes() {
-        return fieldCount * 2;
-    }
+	protected int getFieldSlotsBytes() {
+		return fieldCount * 2;
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriter.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriter.java
index 1730c4a..11f7820 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriter.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriter.java
@@ -23,88 +23,95 @@
 
 public class SimpleTupleWriter implements ITreeIndexTupleWriter {
 
-    @Override
-    public int bytesRequired(ITupleReference tuple) {
-        int bytes = getNullFlagsBytes(tuple) + getFieldSlotsBytes(tuple);
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            bytes += tuple.getFieldLength(i);
-        }
-        return bytes;
-    }
+	@Override
+	public int bytesRequired(ITupleReference tuple) {
+		int bytes = getNullFlagsBytes(tuple) + getFieldSlotsBytes(tuple);
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			bytes += tuple.getFieldLength(i);
+		}
+		return bytes;
+	}
 
-    @Override
-    public int bytesRequired(ITupleReference tuple, int startField, int numFields) {
-        int bytes = getNullFlagsBytes(tuple, startField, numFields) + getFieldSlotsBytes(tuple, startField, numFields);
-        for (int i = startField; i < startField + numFields; i++) {
-            bytes += tuple.getFieldLength(i);
-        }
-        return bytes;
-    }
+	@Override
+	public int bytesRequired(ITupleReference tuple, int startField,
+			int numFields) {
+		int bytes = getNullFlagsBytes(tuple, startField, numFields)
+				+ getFieldSlotsBytes(tuple, startField, numFields);
+		for (int i = startField; i < startField + numFields; i++) {
+			bytes += tuple.getFieldLength(i);
+		}
+		return bytes;
+	}
 
-    @Override
-    public ITreeIndexTupleReference createTupleReference() {
-        return new SimpleTupleReference();
-    }
+	@Override
+	public ITreeIndexTupleReference createTupleReference() {
+		return new SimpleTupleReference();
+	}
 
-    @Override
-    public int writeTuple(ITupleReference tuple, ByteBuffer targetBuf, int targetOff) {
-        int runner = targetOff;
-        int nullFlagsBytes = getNullFlagsBytes(tuple);
-        int fieldSlotsBytes = getFieldSlotsBytes(tuple);
-        for (int i = 0; i < nullFlagsBytes; i++) {
-            targetBuf.put(runner++, (byte) 0);
-        }
-        runner += fieldSlotsBytes;
+	@Override
+	public int writeTuple(ITupleReference tuple, ByteBuffer targetBuf,
+			int targetOff) {
+		int runner = targetOff;
+		int nullFlagsBytes = getNullFlagsBytes(tuple);
+		int fieldSlotsBytes = getFieldSlotsBytes(tuple);
+		for (int i = 0; i < nullFlagsBytes; i++) {
+			targetBuf.put(runner++, (byte) 0);
+		}
+		runner += fieldSlotsBytes;
 
-        int fieldEndOff = 0;
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i), targetBuf.array(), runner,
-                    tuple.getFieldLength(i));
-            fieldEndOff += tuple.getFieldLength(i);
-            runner += tuple.getFieldLength(i);
-            targetBuf.putShort(targetOff + nullFlagsBytes + i * 2, (short) fieldEndOff);
-        }
+		int fieldEndOff = 0;
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i),
+					targetBuf.array(), runner, tuple.getFieldLength(i));
+			fieldEndOff += tuple.getFieldLength(i);
+			runner += tuple.getFieldLength(i);
+			targetBuf.putShort(targetOff + nullFlagsBytes + i * 2,
+					(short) fieldEndOff);
+		}
 
-        return runner - targetOff;
-    }
+		return runner - targetOff;
+	}
 
-    @Override
-    public int writeTupleFields(ITupleReference tuple, int startField, int numFields, ByteBuffer targetBuf,
-            int targetOff) {
-        int runner = targetOff;
-        int nullFlagsBytes = getNullFlagsBytes(tuple, startField, numFields);
-        for (int i = 0; i < nullFlagsBytes; i++) {
-            targetBuf.put(runner++, (byte) 0);
-        }
-        runner += getFieldSlotsBytes(tuple, startField, numFields);
+	@Override
+	public int writeTupleFields(ITupleReference tuple, int startField,
+			int numFields, ByteBuffer targetBuf, int targetOff) {
+		int runner = targetOff;
+		int nullFlagsBytes = getNullFlagsBytes(tuple, startField, numFields);
+		for (int i = 0; i < nullFlagsBytes; i++) {
+			targetBuf.put(runner++, (byte) 0);
+		}
+		runner += getFieldSlotsBytes(tuple, startField, numFields);
 
-        int fieldEndOff = 0;
-        int fieldCounter = 0;
-        for (int i = startField; i < startField + numFields; i++) {
-            System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i), targetBuf.array(), runner,
-                    tuple.getFieldLength(i));
-            fieldEndOff += tuple.getFieldLength(i);
-            runner += tuple.getFieldLength(i);
-            targetBuf.putShort(targetOff + nullFlagsBytes + fieldCounter * 2, (short) fieldEndOff);
-            fieldCounter++;
-        }
+		int fieldEndOff = 0;
+		int fieldCounter = 0;
+		for (int i = startField; i < startField + numFields; i++) {
+			System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i),
+					targetBuf.array(), runner, tuple.getFieldLength(i));
+			fieldEndOff += tuple.getFieldLength(i);
+			runner += tuple.getFieldLength(i);
+			targetBuf.putShort(targetOff + nullFlagsBytes + fieldCounter * 2,
+					(short) fieldEndOff);
+			fieldCounter++;
+		}
 
-        return runner - targetOff;
-    }
+		return runner - targetOff;
+	}
 
-    protected int getNullFlagsBytes(ITupleReference tuple) {
-        return (int) Math.ceil((double) tuple.getFieldCount() / 8.0);
-    }
+	protected int getNullFlagsBytes(ITupleReference tuple) {
+		return (int) Math.ceil((double) tuple.getFieldCount() / 8.0);
+	}
 
-    protected int getFieldSlotsBytes(ITupleReference tuple) {
-        return tuple.getFieldCount() * 2;
-    }
+	protected int getFieldSlotsBytes(ITupleReference tuple) {
+		return tuple.getFieldCount() * 2;
+	}
 
-    protected int getNullFlagsBytes(ITupleReference tuple, int startField, int numFields) {
-        return (int) Math.ceil((double) numFields / 8.0);
-    }
+	protected int getNullFlagsBytes(ITupleReference tuple, int startField,
+			int numFields) {
+		return (int) Math.ceil((double) numFields / 8.0);
+	}
 
-    protected int getFieldSlotsBytes(ITupleReference tuple, int startField, int numFields) {
-        return numFields * 2;
-    }
+	protected int getFieldSlotsBytes(ITupleReference tuple, int startField,
+			int numFields) {
+		return numFields * 2;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriterFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriterFactory.java
index ebb2905..10d4c3a 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriterFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/SimpleTupleWriterFactory.java
@@ -20,11 +20,11 @@
 
 public class SimpleTupleWriterFactory implements ITreeIndexTupleWriterFactory {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    @Override
-    public ITreeIndexTupleWriter createTupleWriter() {
-        return new SimpleTupleWriter();
-    }
+	@Override
+	public ITreeIndexTupleWriter createTupleWriter() {
+		return new SimpleTupleWriter();
+	}
 
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleReference.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleReference.java
index 4f571b3..31b32e6 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleReference.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleReference.java
@@ -22,99 +22,99 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleReference;
 
 public class TypeAwareTupleReference implements ITreeIndexTupleReference {
-    protected ByteBuffer buf;
-    protected int fieldStartIndex;
-    protected int fieldCount;
-    protected int tupleStartOff;
-    protected int nullFlagsBytes;
-    protected int dataStartOff;
+	protected ByteBuffer buf;
+	protected int fieldStartIndex;
+	protected int fieldCount;
+	protected int tupleStartOff;
+	protected int nullFlagsBytes;
+	protected int dataStartOff;
 
-    protected ITypeTrait[] typeTraits;
-    protected VarLenIntEncoderDecoder encDec = new VarLenIntEncoderDecoder();
-    protected int[] decodedFieldSlots;
+	protected ITypeTrait[] typeTraits;
+	protected VarLenIntEncoderDecoder encDec = new VarLenIntEncoderDecoder();
+	protected int[] decodedFieldSlots;
 
-    public TypeAwareTupleReference(ITypeTrait[] typeTraits) {
-        this.typeTraits = typeTraits;
-        this.fieldStartIndex = 0;
-    }
+	public TypeAwareTupleReference(ITypeTrait[] typeTraits) {
+		this.typeTraits = typeTraits;
+		this.fieldStartIndex = 0;
+	}
 
-    @Override
-    public void resetByTupleOffset(ByteBuffer buf, int tupleStartOff) {
-        this.buf = buf;
-        this.tupleStartOff = tupleStartOff;
+	@Override
+	public void resetByTupleOffset(ByteBuffer buf, int tupleStartOff) {
+		this.buf = buf;
+		this.tupleStartOff = tupleStartOff;
 
-        // decode field slots
-        int field = 0;
-        int cumul = 0;
-        int end = fieldStartIndex + fieldCount;
-        encDec.reset(buf.array(), tupleStartOff + nullFlagsBytes);
-        for (int i = fieldStartIndex; i < end; i++) {
-            int staticDataLen = typeTraits[i].getStaticallyKnownDataLength();
-            if (staticDataLen == ITypeTrait.VARIABLE_LENGTH) {
-                cumul += encDec.decode();
-                decodedFieldSlots[field++] = cumul;
-            } else {
-                cumul += staticDataLen;
-                decodedFieldSlots[field++] = cumul;
-            }
-        }
-        dataStartOff = encDec.getPos();
-    }
+		// decode field slots
+		int field = 0;
+		int cumul = 0;
+		int end = fieldStartIndex + fieldCount;
+		encDec.reset(buf.array(), tupleStartOff + nullFlagsBytes);
+		for (int i = fieldStartIndex; i < end; i++) {
+			int staticDataLen = typeTraits[i].getStaticallyKnownDataLength();
+			if (staticDataLen == ITypeTrait.VARIABLE_LENGTH) {
+				cumul += encDec.decode();
+				decodedFieldSlots[field++] = cumul;
+			} else {
+				cumul += staticDataLen;
+				decodedFieldSlots[field++] = cumul;
+			}
+		}
+		dataStartOff = encDec.getPos();
+	}
 
-    @Override
-    public void resetByTupleIndex(ITreeIndexFrame frame, int tupleIndex) {
-        resetByTupleOffset(frame.getBuffer(), frame.getTupleOffset(tupleIndex));
-    }
+	@Override
+	public void resetByTupleIndex(ITreeIndexFrame frame, int tupleIndex) {
+		resetByTupleOffset(frame.getBuffer(), frame.getTupleOffset(tupleIndex));
+	}
 
-    @Override
-    public void setFieldCount(int fieldCount) {
-        this.fieldCount = fieldCount;
-        if (decodedFieldSlots == null) {
-            decodedFieldSlots = new int[fieldCount];
-        } else {
-            if (fieldCount > decodedFieldSlots.length) {
-                decodedFieldSlots = new int[fieldCount];
-            }
-        }
-        nullFlagsBytes = getNullFlagsBytes();
-        this.fieldStartIndex = 0;
-    }
+	@Override
+	public void setFieldCount(int fieldCount) {
+		this.fieldCount = fieldCount;
+		if (decodedFieldSlots == null) {
+			decodedFieldSlots = new int[fieldCount];
+		} else {
+			if (fieldCount > decodedFieldSlots.length) {
+				decodedFieldSlots = new int[fieldCount];
+			}
+		}
+		nullFlagsBytes = getNullFlagsBytes();
+		this.fieldStartIndex = 0;
+	}
 
-    @Override
-    public void setFieldCount(int fieldStartIndex, int fieldCount) {
-        setFieldCount(fieldCount);
-        this.fieldStartIndex = fieldStartIndex;
-    }
+	@Override
+	public void setFieldCount(int fieldStartIndex, int fieldCount) {
+		setFieldCount(fieldCount);
+		this.fieldStartIndex = fieldStartIndex;
+	}
 
-    @Override
-    public int getFieldCount() {
-        return fieldCount;
-    }
+	@Override
+	public int getFieldCount() {
+		return fieldCount;
+	}
 
-    @Override
-    public byte[] getFieldData(int fIdx) {
-        return buf.array();
-    }
+	@Override
+	public byte[] getFieldData(int fIdx) {
+		return buf.array();
+	}
 
-    @Override
-    public int getFieldLength(int fIdx) {
-        if (fIdx == 0) {
-            return decodedFieldSlots[0];
-        } else {
-            return decodedFieldSlots[fIdx] - decodedFieldSlots[fIdx - 1];
-        }
-    }
+	@Override
+	public int getFieldLength(int fIdx) {
+		if (fIdx == 0) {
+			return decodedFieldSlots[0];
+		} else {
+			return decodedFieldSlots[fIdx] - decodedFieldSlots[fIdx - 1];
+		}
+	}
 
-    @Override
-    public int getFieldStart(int fIdx) {
-        if (fIdx == 0) {
-            return dataStartOff;
-        } else {
-            return dataStartOff + decodedFieldSlots[fIdx - 1];
-        }
-    }
+	@Override
+	public int getFieldStart(int fIdx) {
+		if (fIdx == 0) {
+			return dataStartOff;
+		} else {
+			return dataStartOff + decodedFieldSlots[fIdx - 1];
+		}
+	}
 
-    protected int getNullFlagsBytes() {
-        return (int) Math.ceil(fieldCount / 8.0);
-    }
+	protected int getNullFlagsBytes() {
+		return (int) Math.ceil(fieldCount / 8.0);
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriter.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriter.java
index 81b48e5..95468d4 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriter.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriter.java
@@ -24,125 +24,131 @@
 
 public class TypeAwareTupleWriter implements ITreeIndexTupleWriter {
 
-    protected ITypeTrait[] typeTraits;
-    protected VarLenIntEncoderDecoder encDec = new VarLenIntEncoderDecoder();
+	protected ITypeTrait[] typeTraits;
+	protected VarLenIntEncoderDecoder encDec = new VarLenIntEncoderDecoder();
 
-    public TypeAwareTupleWriter(ITypeTrait[] typeTraits) {
-        this.typeTraits = typeTraits;
-    }
+	public TypeAwareTupleWriter(ITypeTrait[] typeTraits) {
+		this.typeTraits = typeTraits;
+	}
 
-    @Override
-    public int bytesRequired(ITupleReference tuple) {
-        int bytes = getNullFlagsBytes(tuple) + getFieldSlotsBytes(tuple);
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            bytes += tuple.getFieldLength(i);
-        }
-        return bytes;
-    }
+	@Override
+	public int bytesRequired(ITupleReference tuple) {
+		int bytes = getNullFlagsBytes(tuple) + getFieldSlotsBytes(tuple);
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			bytes += tuple.getFieldLength(i);
+		}
+		return bytes;
+	}
 
-    @Override
-    public int bytesRequired(ITupleReference tuple, int startField, int numFields) {
-        int bytes = getNullFlagsBytes(numFields) + getFieldSlotsBytes(tuple, startField, numFields);
-        for (int i = startField; i < startField + numFields; i++) {
-            bytes += tuple.getFieldLength(i);
-        }
-        return bytes;
-    }
+	@Override
+	public int bytesRequired(ITupleReference tuple, int startField,
+			int numFields) {
+		int bytes = getNullFlagsBytes(numFields)
+				+ getFieldSlotsBytes(tuple, startField, numFields);
+		for (int i = startField; i < startField + numFields; i++) {
+			bytes += tuple.getFieldLength(i);
+		}
+		return bytes;
+	}
 
-    @Override
-    public ITreeIndexTupleReference createTupleReference() {
-        return new TypeAwareTupleReference(typeTraits);
-    }
+	@Override
+	public ITreeIndexTupleReference createTupleReference() {
+		return new TypeAwareTupleReference(typeTraits);
+	}
 
-    @Override
-    public int writeTuple(ITupleReference tuple, ByteBuffer targetBuf, int targetOff) {
-        int runner = targetOff;
-        int nullFlagsBytes = getNullFlagsBytes(tuple);
-        // write null indicator bits
-        for (int i = 0; i < nullFlagsBytes; i++) {
-            targetBuf.put(runner++, (byte) 0);
-        }
+	@Override
+	public int writeTuple(ITupleReference tuple, ByteBuffer targetBuf,
+			int targetOff) {
+		int runner = targetOff;
+		int nullFlagsBytes = getNullFlagsBytes(tuple);
+		// write null indicator bits
+		for (int i = 0; i < nullFlagsBytes; i++) {
+			targetBuf.put(runner++, (byte) 0);
+		}
 
-        // write field slots for variable length fields
-        encDec.reset(targetBuf.array(), runner);
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
-                encDec.encode(tuple.getFieldLength(i));
-            }
-        }
-        runner = encDec.getPos();
+		// write field slots for variable length fields
+		encDec.reset(targetBuf.array(), runner);
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
+				encDec.encode(tuple.getFieldLength(i));
+			}
+		}
+		runner = encDec.getPos();
 
-        // write data fields
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i), targetBuf.array(), runner,
-                    tuple.getFieldLength(i));
-            runner += tuple.getFieldLength(i);
-        }
+		// write data fields
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i),
+					targetBuf.array(), runner, tuple.getFieldLength(i));
+			runner += tuple.getFieldLength(i);
+		}
 
-        return runner - targetOff;
-    }
+		return runner - targetOff;
+	}
 
-    @Override
-    public int writeTupleFields(ITupleReference tuple, int startField, int numFields, ByteBuffer targetBuf,
-            int targetOff) {
-        int runner = targetOff;
-        int nullFlagsBytes = getNullFlagsBytes(numFields);
-        // write null indicator bits
-        for (int i = 0; i < nullFlagsBytes; i++) {
-            targetBuf.put(runner++, (byte) 0);
-        }
+	@Override
+	public int writeTupleFields(ITupleReference tuple, int startField,
+			int numFields, ByteBuffer targetBuf, int targetOff) {
+		int runner = targetOff;
+		int nullFlagsBytes = getNullFlagsBytes(numFields);
+		// write null indicator bits
+		for (int i = 0; i < nullFlagsBytes; i++) {
+			targetBuf.put(runner++, (byte) 0);
+		}
 
-        // write field slots for variable length fields
-        encDec.reset(targetBuf.array(), runner);
-        for (int i = startField; i < startField + numFields; i++) {
-            if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
-                encDec.encode(tuple.getFieldLength(i));
-            }
-        }
-        runner = encDec.getPos();
+		// write field slots for variable length fields
+		encDec.reset(targetBuf.array(), runner);
+		for (int i = startField; i < startField + numFields; i++) {
+			if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
+				encDec.encode(tuple.getFieldLength(i));
+			}
+		}
+		runner = encDec.getPos();
 
-        for (int i = startField; i < startField + numFields; i++) {
-            System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i), targetBuf.array(), runner,
-                    tuple.getFieldLength(i));
-            runner += tuple.getFieldLength(i);
-        }
+		for (int i = startField; i < startField + numFields; i++) {
+			System.arraycopy(tuple.getFieldData(i), tuple.getFieldStart(i),
+					targetBuf.array(), runner, tuple.getFieldLength(i));
+			runner += tuple.getFieldLength(i);
+		}
 
-        return runner - targetOff;
-    }
+		return runner - targetOff;
+	}
 
-    protected int getNullFlagsBytes(ITupleReference tuple) {
-        return (int) Math.ceil((double) tuple.getFieldCount() / 8.0);
-    }
+	protected int getNullFlagsBytes(ITupleReference tuple) {
+		return (int) Math.ceil((double) tuple.getFieldCount() / 8.0);
+	}
 
-    protected int getFieldSlotsBytes(ITupleReference tuple) {
-        int fieldSlotBytes = 0;
-        for (int i = 0; i < tuple.getFieldCount(); i++) {
-            if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
-                fieldSlotBytes += encDec.getBytesRequired(tuple.getFieldLength(i));
-            }
-        }
-        return fieldSlotBytes;
-    }
+	protected int getFieldSlotsBytes(ITupleReference tuple) {
+		int fieldSlotBytes = 0;
+		for (int i = 0; i < tuple.getFieldCount(); i++) {
+			if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
+				fieldSlotBytes += encDec.getBytesRequired(tuple
+						.getFieldLength(i));
+			}
+		}
+		return fieldSlotBytes;
+	}
 
-    protected int getNullFlagsBytes(int numFields) {
-        return (int) Math.ceil((double) numFields / 8.0);
-    }
+	protected int getNullFlagsBytes(int numFields) {
+		return (int) Math.ceil((double) numFields / 8.0);
+	}
 
-    protected int getFieldSlotsBytes(ITupleReference tuple, int startField, int numFields) {
-        int fieldSlotBytes = 0;
-        for (int i = startField; i < startField + numFields; i++) {
-            if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
-                fieldSlotBytes += encDec.getBytesRequired(tuple.getFieldLength(i));
-            }
-        }
-        return fieldSlotBytes;
-    }
+	protected int getFieldSlotsBytes(ITupleReference tuple, int startField,
+			int numFields) {
+		int fieldSlotBytes = 0;
+		for (int i = startField; i < startField + numFields; i++) {
+			if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
+				fieldSlotBytes += encDec.getBytesRequired(tuple
+						.getFieldLength(i));
+			}
+		}
+		return fieldSlotBytes;
+	}
 
-    public ITypeTrait[] getTypeTraits() {
-        return typeTraits;
-    }
+	public ITypeTrait[] getTypeTraits() {
+		return typeTraits;
+	}
 
-    public void setTypeTraits(ITypeTrait[] typeTraits) {
-        this.typeTraits = typeTraits;
-    }
+	public void setTypeTraits(ITypeTrait[] typeTraits) {
+		this.typeTraits = typeTraits;
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriterFactory.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriterFactory.java
index 82072ae..28e2535 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriterFactory.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/TypeAwareTupleWriterFactory.java
@@ -19,18 +19,19 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriter;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriterFactory;
 
-public class TypeAwareTupleWriterFactory implements ITreeIndexTupleWriterFactory {
+public class TypeAwareTupleWriterFactory implements
+		ITreeIndexTupleWriterFactory {
 
-    private static final long serialVersionUID = 1L;
-    private ITypeTrait[] typeTraits;
+	private static final long serialVersionUID = 1L;
+	private ITypeTrait[] typeTraits;
 
-    public TypeAwareTupleWriterFactory(ITypeTrait[] typeTraits) {
-        this.typeTraits = typeTraits;
-    }
+	public TypeAwareTupleWriterFactory(ITypeTrait[] typeTraits) {
+		this.typeTraits = typeTraits;
+	}
 
-    @Override
-    public ITreeIndexTupleWriter createTupleWriter() {
-        return new TypeAwareTupleWriter(typeTraits);
-    }
+	@Override
+	public ITreeIndexTupleWriter createTupleWriter() {
+		return new TypeAwareTupleWriter(typeTraits);
+	}
 
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/VarLenIntEncoderDecoder.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/VarLenIntEncoderDecoder.java
index d266d41..979bbd3 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/VarLenIntEncoderDecoder.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/tuples/VarLenIntEncoderDecoder.java
@@ -18,71 +18,71 @@
 // encodes positive integers in a variable-byte format
 
 public class VarLenIntEncoderDecoder {
-    public static final int ENCODE_MASK = 0x0000007F;
-    public static final byte CONTINUE_CHUNK = (byte) 0x80;
-    public static final byte DECODE_MASK = (byte) 0x7F;
+	public static final int ENCODE_MASK = 0x0000007F;
+	public static final byte CONTINUE_CHUNK = (byte) 0x80;
+	public static final byte DECODE_MASK = (byte) 0x7F;
 
-    private byte[] encTmp = new byte[5];
+	private byte[] encTmp = new byte[5];
 
-    private int pos;
-    private byte[] bytes;
+	private int pos;
+	private byte[] bytes;
 
-    public void reset(byte[] bytes, int pos) {
-        this.bytes = bytes;
-        this.pos = pos;
-    }
+	public void reset(byte[] bytes, int pos) {
+		this.bytes = bytes;
+		this.pos = pos;
+	}
 
-    public int encode(int val) {
-        int origPos = 0;
-        int tmpPos = 0;
-        while (val > ENCODE_MASK) {
-            encTmp[tmpPos++] = (byte) (val & ENCODE_MASK);
-            val = val >>> 7;
-        }
-        encTmp[tmpPos++] = (byte) (val);
+	public int encode(int val) {
+		int origPos = 0;
+		int tmpPos = 0;
+		while (val > ENCODE_MASK) {
+			encTmp[tmpPos++] = (byte) (val & ENCODE_MASK);
+			val = val >>> 7;
+		}
+		encTmp[tmpPos++] = (byte) (val);
 
-        // reverse order to optimize for decoding speed
-        for (int i = 0; i < tmpPos - 1; i++) {
-            bytes[pos++] = (byte) (encTmp[tmpPos - 1 - i] | CONTINUE_CHUNK);
-        }
-        bytes[pos++] = encTmp[0];
+		// reverse order to optimize for decoding speed
+		for (int i = 0; i < tmpPos - 1; i++) {
+			bytes[pos++] = (byte) (encTmp[tmpPos - 1 - i] | CONTINUE_CHUNK);
+		}
+		bytes[pos++] = encTmp[0];
 
-        return pos - origPos;
-    }
+		return pos - origPos;
+	}
 
-    public int decode() {
-        int sum = 0;
-        while ((bytes[pos] & CONTINUE_CHUNK) == CONTINUE_CHUNK) {
-            sum = (sum + (bytes[pos] & DECODE_MASK)) << 7;
-            pos++;
-        }
-        sum += bytes[pos++];
-        return sum;
-    }
+	public int decode() {
+		int sum = 0;
+		while ((bytes[pos] & CONTINUE_CHUNK) == CONTINUE_CHUNK) {
+			sum = (sum + (bytes[pos] & DECODE_MASK)) << 7;
+			pos++;
+		}
+		sum += bytes[pos++];
+		return sum;
+	}
 
-    // calculate the number of bytes needed for encoding
-    public int getBytesRequired(int val) {
-        int byteCount = 0;
-        while (val > ENCODE_MASK) {
-            val = val >>> 7;
-            byteCount++;
-        }
-        return byteCount + 1;
-    }
+	// calculate the number of bytes needed for encoding
+	public int getBytesRequired(int val) {
+		int byteCount = 0;
+		while (val > ENCODE_MASK) {
+			val = val >>> 7;
+			byteCount++;
+		}
+		return byteCount + 1;
+	}
 
-    public int getPos() {
-        return pos;
-    }
+	public int getPos() {
+		return pos;
+	}
 
-    // fast encoding, slow decoding version
-    /*
-     * public void encode(int val) { while(val > ENCODE_MASK) { bytes[pos++] =
-     * (byte)(((byte)(val & ENCODE_MASK)) | CONTINUE_CHUNK); val = val >>> 7; }
-     * bytes[pos++] = (byte)(val); }
-     * 
-     * public int decode() { int sum = 0; int shift = 0; while( (bytes[pos] &
-     * CONTINUE_CHUNK) == CONTINUE_CHUNK) { sum = (sum + (bytes[pos] &
-     * DECODE_MASK)) << 7 * shift++; pos++; } sum += bytes[pos++] << 7 * shift;
-     * return sum; }
-     */
+	// fast encoding, slow decoding version
+	/*
+	 * public void encode(int val) { while(val > ENCODE_MASK) { bytes[pos++] =
+	 * (byte)(((byte)(val & ENCODE_MASK)) | CONTINUE_CHUNK); val = val >>> 7; }
+	 * bytes[pos++] = (byte)(val); }
+	 * 
+	 * public int decode() { int sum = 0; int shift = 0; while( (bytes[pos] &
+	 * CONTINUE_CHUNK) == CONTINUE_CHUNK) { sum = (sum + (bytes[pos] &
+	 * DECODE_MASK)) << 7 * shift++; pos++; } sum += bytes[pos++] << 7 * shift;
+	 * return sum; }
+	 */
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexBufferCacheWarmup.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexBufferCacheWarmup.java
index eb261da..8179d58 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexBufferCacheWarmup.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexBufferCacheWarmup.java
@@ -13,72 +13,76 @@
 import edu.uci.ics.hyracks.storage.common.file.BufferedFileHandle;
 
 public class TreeIndexBufferCacheWarmup {
-    private final IBufferCache bufferCache;
-    private final IFreePageManager freePageManager;
-    private final int fileId;
-    private final ArrayList<IntArrayList> pagesByLevel = new ArrayList<IntArrayList>();
-    private final Random rnd = new Random();
+	private final IBufferCache bufferCache;
+	private final IFreePageManager freePageManager;
+	private final int fileId;
+	private final ArrayList<IntArrayList> pagesByLevel = new ArrayList<IntArrayList>();
+	private final Random rnd = new Random();
 
-    public TreeIndexBufferCacheWarmup(IBufferCache bufferCache, IFreePageManager freePageManager, int fileId) {
-        this.bufferCache = bufferCache;
-        this.freePageManager = freePageManager;
-        this.fileId = fileId;
-    }
+	public TreeIndexBufferCacheWarmup(IBufferCache bufferCache,
+			IFreePageManager freePageManager, int fileId) {
+		this.bufferCache = bufferCache;
+		this.freePageManager = freePageManager;
+		this.fileId = fileId;
+	}
 
-    public void warmup(ITreeIndexFrame frame, ITreeIndexMetaDataFrame metaFrame, int[] warmupTreeLevels,
-            int[] warmupRepeats) throws HyracksDataException {
-        bufferCache.openFile(fileId);
+	public void warmup(ITreeIndexFrame frame,
+			ITreeIndexMetaDataFrame metaFrame, int[] warmupTreeLevels,
+			int[] warmupRepeats) throws HyracksDataException {
+		bufferCache.openFile(fileId);
 
-        // scan entire file to determine pages in each level
-        int maxPageId = freePageManager.getMaxPage(metaFrame);
-        for (int pageId = 0; pageId <= maxPageId; pageId++) {
-            ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-            page.acquireReadLatch();
-            try {
-                frame.setPage(page);
-                byte level = frame.getLevel();
-                while (level >= pagesByLevel.size()) {
-                    pagesByLevel.add(new IntArrayList(100, 100));
-                }
-                if (level >= 0) {
-                    // System.out.println("ADDING: " + level + " " + pageId);
-                    pagesByLevel.get(level).add(pageId);
-                }
-            } finally {
-                page.releaseReadLatch();
-                bufferCache.unpin(page);
-            }
-        }
+		// scan entire file to determine pages in each level
+		int maxPageId = freePageManager.getMaxPage(metaFrame);
+		for (int pageId = 0; pageId <= maxPageId; pageId++) {
+			ICachedPage page = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, pageId), false);
+			page.acquireReadLatch();
+			try {
+				frame.setPage(page);
+				byte level = frame.getLevel();
+				while (level >= pagesByLevel.size()) {
+					pagesByLevel.add(new IntArrayList(100, 100));
+				}
+				if (level >= 0) {
+					// System.out.println("ADDING: " + level + " " + pageId);
+					pagesByLevel.get(level).add(pageId);
+				}
+			} finally {
+				page.releaseReadLatch();
+				bufferCache.unpin(page);
+			}
+		}
 
-        // pin certain pages again to simulate frequent access
-        for (int i = 0; i < warmupTreeLevels.length; i++) {
-            if (warmupTreeLevels[i] < pagesByLevel.size()) {
-                int repeats = warmupRepeats[i];
-                IntArrayList pageIds = pagesByLevel.get(warmupTreeLevels[i]);
-                int[] remainingPageIds = new int[pageIds.size()];
-                for (int r = 0; r < repeats; r++) {
-                    for (int j = 0; j < pageIds.size(); j++) {
-                        remainingPageIds[j] = pageIds.get(j);
-                    }
+		// pin certain pages again to simulate frequent access
+		for (int i = 0; i < warmupTreeLevels.length; i++) {
+			if (warmupTreeLevels[i] < pagesByLevel.size()) {
+				int repeats = warmupRepeats[i];
+				IntArrayList pageIds = pagesByLevel.get(warmupTreeLevels[i]);
+				int[] remainingPageIds = new int[pageIds.size()];
+				for (int r = 0; r < repeats; r++) {
+					for (int j = 0; j < pageIds.size(); j++) {
+						remainingPageIds[j] = pageIds.get(j);
+					}
 
-                    int remainingLength = pageIds.size();
-                    for (int j = 0; j < pageIds.size(); j++) {
-                        int index = Math.abs(rnd.nextInt()) % remainingLength;
-                        int pageId = remainingPageIds[index];
+					int remainingLength = pageIds.size();
+					for (int j = 0; j < pageIds.size(); j++) {
+						int index = Math.abs(rnd.nextInt()) % remainingLength;
+						int pageId = remainingPageIds[index];
 
-                        // pin & latch then immediately unlatch & unpin
-                        ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-                        page.acquireReadLatch();
-                        page.releaseReadLatch();
-                        bufferCache.unpin(page);
+						// pin & latch then immediately unlatch & unpin
+						ICachedPage page = bufferCache.pin(BufferedFileHandle
+								.getDiskPageId(fileId, pageId), false);
+						page.acquireReadLatch();
+						page.releaseReadLatch();
+						bufferCache.unpin(page);
 
-                        remainingPageIds[index] = remainingPageIds[remainingLength - 1];
-                        remainingLength--;
-                    }
-                }
-            }
-        }
+						remainingPageIds[index] = remainingPageIds[remainingLength - 1];
+						remainingLength--;
+					}
+				}
+			}
+		}
 
-        bufferCache.closeFile(fileId);
-    }
+		bufferCache.closeFile(fileId);
+	}
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStats.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStats.java
index 5b01b2d..2754743 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStats.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStats.java
@@ -8,127 +8,140 @@
 
 public class TreeIndexStats {
 
-    private TreeIndexNodeTypeStats rootStats = new TreeIndexNodeTypeStats();
-    private TreeIndexNodeTypeStats interiorStats = new TreeIndexNodeTypeStats();
-    private TreeIndexNodeTypeStats leafStats = new TreeIndexNodeTypeStats();
+	private TreeIndexNodeTypeStats rootStats = new TreeIndexNodeTypeStats();
+	private TreeIndexNodeTypeStats interiorStats = new TreeIndexNodeTypeStats();
+	private TreeIndexNodeTypeStats leafStats = new TreeIndexNodeTypeStats();
 
-    private int freePages = 0;
-    private int metaPages = 0;
-    private int treeLevels = 0;
+	private int freePages = 0;
+	private int metaPages = 0;
+	private int treeLevels = 0;
 
-    public void begin() {
-        rootStats.clear();
-        interiorStats.clear();
-        leafStats.clear();
-        freePages = 0;
-        metaPages = 0;
-        treeLevels = 0;
-    }
+	public void begin() {
+		rootStats.clear();
+		interiorStats.clear();
+		leafStats.clear();
+		freePages = 0;
+		metaPages = 0;
+		treeLevels = 0;
+	}
 
-    public void addRoot(ITreeIndexFrame frame) {
-        treeLevels = frame.getLevel() + 1;
-        rootStats.add(frame);
-    }
+	public void addRoot(ITreeIndexFrame frame) {
+		treeLevels = frame.getLevel() + 1;
+		rootStats.add(frame);
+	}
 
-    public void add(ITreeIndexFrame frame) {
-        if (frame.isLeaf()) {
-            leafStats.add(frame);
-        } else if (frame.isInterior()) {
-            interiorStats.add(frame);
-        }
-    }
+	public void add(ITreeIndexFrame frame) {
+		if (frame.isLeaf()) {
+			leafStats.add(frame);
+		} else if (frame.isInterior()) {
+			interiorStats.add(frame);
+		}
+	}
 
-    public void add(ITreeIndexMetaDataFrame metaFrame, IFreePageManager freePageManager) {
-        if (freePageManager.isFreePage(metaFrame)) {
-            freePages++;
-        } else if (freePageManager.isMetaPage(metaFrame)) {
-            metaPages++;
-        }
-    }
+	public void add(ITreeIndexMetaDataFrame metaFrame,
+			IFreePageManager freePageManager) {
+		if (freePageManager.isFreePage(metaFrame)) {
+			freePages++;
+		} else if (freePageManager.isMetaPage(metaFrame)) {
+			metaPages++;
+		}
+	}
 
-    public void end() {
-        // nothing here currently
-    }
+	public void end() {
+		// nothing here currently
+	}
 
-    @Override
-    public String toString() {
-        StringBuilder strBuilder = new StringBuilder();
-        DecimalFormat df = new DecimalFormat("#####.##");
+	@Override
+	public String toString() {
+		StringBuilder strBuilder = new StringBuilder();
+		DecimalFormat df = new DecimalFormat("#####.##");
 
-        strBuilder.append("TREE LEVELS:  " + treeLevels + "\n");
-        strBuilder.append("FREE PAGES :  " + freePages + "\n");
-        strBuilder.append("META PAGES :  " + metaPages + "\n");
-        long totalPages = interiorStats.getNumPages() + leafStats.getNumPages() + freePages + metaPages;
-        strBuilder.append("TOTAL PAGES : " + totalPages + "\n");
+		strBuilder.append("TREE LEVELS:  " + treeLevels + "\n");
+		strBuilder.append("FREE PAGES :  " + freePages + "\n");
+		strBuilder.append("META PAGES :  " + metaPages + "\n");
+		long totalPages = interiorStats.getNumPages() + leafStats.getNumPages()
+				+ freePages + metaPages;
+		strBuilder.append("TOTAL PAGES : " + totalPages + "\n");
 
-        strBuilder.append("\n");
-        strBuilder.append("ROOT STATS" + "\n");
-        strBuilder.append("NUM TUPLES:      " + rootStats.getNumTuples() + "\n");
-        strBuilder.append("FILL FACTOR    : " + df.format(rootStats.getAvgFillFactor()) + "\n");
+		strBuilder.append("\n");
+		strBuilder.append("ROOT STATS" + "\n");
+		strBuilder
+				.append("NUM TUPLES:      " + rootStats.getNumTuples() + "\n");
+		strBuilder.append("FILL FACTOR    : "
+				+ df.format(rootStats.getAvgFillFactor()) + "\n");
 
-        if (interiorStats.getNumPages() > 0) {
-            strBuilder.append("\n");
-            strBuilder.append("INTERIOR STATS" + "\n");
-            strBuilder.append("NUM PAGES:       " + interiorStats.getNumPages() + "\n");
-            strBuilder.append("NUM TUPLES:      " + interiorStats.getNumTuples() + "\n");
-            strBuilder.append("AVG TUPLES/PAGE: " + df.format(interiorStats.getAvgNumTuples()) + "\n");
-            strBuilder.append("AVG FILL FACTOR: " + df.format(interiorStats.getAvgFillFactor()) + "\n");
-        }
+		if (interiorStats.getNumPages() > 0) {
+			strBuilder.append("\n");
+			strBuilder.append("INTERIOR STATS" + "\n");
+			strBuilder.append("NUM PAGES:       " + interiorStats.getNumPages()
+					+ "\n");
+			strBuilder.append("NUM TUPLES:      "
+					+ interiorStats.getNumTuples() + "\n");
+			strBuilder.append("AVG TUPLES/PAGE: "
+					+ df.format(interiorStats.getAvgNumTuples()) + "\n");
+			strBuilder.append("AVG FILL FACTOR: "
+					+ df.format(interiorStats.getAvgFillFactor()) + "\n");
+		}
 
-        if (leafStats.getNumPages() > 0) {
-            strBuilder.append("\n");
-            strBuilder.append("LEAF STATS" + "\n");
-            strBuilder.append("NUM PAGES:       " + df.format(leafStats.getNumPages()) + "\n");
-            strBuilder.append("NUM TUPLES:      " + df.format(leafStats.getNumTuples()) + "\n");
-            strBuilder.append("AVG TUPLES/PAGE: " + df.format(leafStats.getAvgNumTuples()) + "\n");
-            strBuilder.append("AVG FILL FACTOR: " + df.format(leafStats.getAvgFillFactor()) + "\n");
-        }
+		if (leafStats.getNumPages() > 0) {
+			strBuilder.append("\n");
+			strBuilder.append("LEAF STATS" + "\n");
+			strBuilder.append("NUM PAGES:       "
+					+ df.format(leafStats.getNumPages()) + "\n");
+			strBuilder.append("NUM TUPLES:      "
+					+ df.format(leafStats.getNumTuples()) + "\n");
+			strBuilder.append("AVG TUPLES/PAGE: "
+					+ df.format(leafStats.getAvgNumTuples()) + "\n");
+			strBuilder.append("AVG FILL FACTOR: "
+					+ df.format(leafStats.getAvgFillFactor()) + "\n");
+		}
 
-        return strBuilder.toString();
-    }
+		return strBuilder.toString();
+	}
 
-    public class TreeIndexNodeTypeStats {
-        private long numTuples;
-        private long sumTuplesSizes;
-        private long numPages;
-        private double sumFillFactors;
+	public class TreeIndexNodeTypeStats {
+		private long numTuples;
+		private long sumTuplesSizes;
+		private long numPages;
+		private double sumFillFactors;
 
-        public void clear() {
-            numTuples = 0;
-            sumTuplesSizes = 0;
-            numPages = 0;
-        }
+		public void clear() {
+			numTuples = 0;
+			sumTuplesSizes = 0;
+			numPages = 0;
+		}
 
-        public void add(ITreeIndexFrame frame) {
-            numPages++;
-            numTuples += frame.getTupleCount();
-            sumFillFactors += (double) (frame.getBuffer().capacity() - frame.getTotalFreeSpace())
-                    / (double) frame.getBuffer().capacity();
-        }
+		public void add(ITreeIndexFrame frame) {
+			numPages++;
+			numTuples += frame.getTupleCount();
+			sumFillFactors += (double) (frame.getBuffer().capacity() - frame
+					.getTotalFreeSpace())
+					/ (double) frame.getBuffer().capacity();
+		}
 
-        public long getNumTuples() {
-            return numTuples;
-        }
+		public long getNumTuples() {
+			return numTuples;
+		}
 
-        public long getSumTupleSizes() {
-            return sumTuplesSizes;
-        }
+		public long getSumTupleSizes() {
+			return sumTuplesSizes;
+		}
 
-        public long getNumPages() {
-            return numPages;
-        }
+		public long getNumPages() {
+			return numPages;
+		}
 
-        public double getAvgNumTuples() {
-            return (double) numTuples / (double) numPages;
-        }
+		public double getAvgNumTuples() {
+			return (double) numTuples / (double) numPages;
+		}
 
-        public double getAvgTupleSize() {
-            return (double) sumTuplesSizes / (double) numTuples;
-        }
+		public double getAvgTupleSize() {
+			return (double) sumTuplesSizes / (double) numTuples;
+		}
 
-        public double getAvgFillFactor() {
-            return sumFillFactors / numPages;
-        }
-    }
+		public double getAvgFillFactor() {
+			return sumFillFactors / numPages;
+		}
+	}
 
 }
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStatsGatherer.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStatsGatherer.java
index fc0ab5e..9167732 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStatsGatherer.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/utility/TreeIndexStatsGatherer.java
@@ -10,61 +10,64 @@
 
 public class TreeIndexStatsGatherer {
 
-    private final TreeIndexStats treeIndexStats = new TreeIndexStats();
-    private final IBufferCache bufferCache;
-    private final IFreePageManager freePageManager;
-    private final int fileId;
-    private final int rootPage;
+	private final TreeIndexStats treeIndexStats = new TreeIndexStats();
+	private final IBufferCache bufferCache;
+	private final IFreePageManager freePageManager;
+	private final int fileId;
+	private final int rootPage;
 
-    public TreeIndexStatsGatherer(IBufferCache bufferCache, IFreePageManager freePageManager, int fileId, int rootPage) {
-        this.bufferCache = bufferCache;
-        this.freePageManager = freePageManager;
-        this.fileId = fileId;
-        this.rootPage = rootPage;
-    }
+	public TreeIndexStatsGatherer(IBufferCache bufferCache,
+			IFreePageManager freePageManager, int fileId, int rootPage) {
+		this.bufferCache = bufferCache;
+		this.freePageManager = freePageManager;
+		this.fileId = fileId;
+		this.rootPage = rootPage;
+	}
 
-    public TreeIndexStats gatherStats(ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
-            ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
+	public TreeIndexStats gatherStats(ITreeIndexFrame leafFrame,
+			ITreeIndexFrame interiorFrame, ITreeIndexMetaDataFrame metaFrame)
+			throws HyracksDataException {
 
-        bufferCache.openFile(fileId);
+		bufferCache.openFile(fileId);
 
-        treeIndexStats.begin();
+		treeIndexStats.begin();
 
-        int maxPageId = freePageManager.getMaxPage(metaFrame);
-        for (int pageId = 0; pageId <= maxPageId; pageId++) {
-            ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-            page.acquireReadLatch();
-            try {
-                metaFrame.setPage(page);
-                leafFrame.setPage(page);
-                interiorFrame.setPage(page);
+		int maxPageId = freePageManager.getMaxPage(metaFrame);
+		for (int pageId = 0; pageId <= maxPageId; pageId++) {
+			ICachedPage page = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, pageId), false);
+			page.acquireReadLatch();
+			try {
+				metaFrame.setPage(page);
+				leafFrame.setPage(page);
+				interiorFrame.setPage(page);
 
-                if (leafFrame.isLeaf()) {
-                    if (pageId == rootPage) {
-                        treeIndexStats.addRoot(leafFrame);
-                    } else {
-                        treeIndexStats.add(leafFrame);
-                    }
-                } else if (interiorFrame.isInterior()) {
-                    if (pageId == rootPage) {
-                        treeIndexStats.addRoot(interiorFrame);
-                    } else {
-                        treeIndexStats.add(interiorFrame);
-                    }
-                } else {
-                    treeIndexStats.add(metaFrame, freePageManager);
-                }
+				if (leafFrame.isLeaf()) {
+					if (pageId == rootPage) {
+						treeIndexStats.addRoot(leafFrame);
+					} else {
+						treeIndexStats.add(leafFrame);
+					}
+				} else if (interiorFrame.isInterior()) {
+					if (pageId == rootPage) {
+						treeIndexStats.addRoot(interiorFrame);
+					} else {
+						treeIndexStats.add(interiorFrame);
+					}
+				} else {
+					treeIndexStats.add(metaFrame, freePageManager);
+				}
 
-            } finally {
-                page.releaseReadLatch();
-                bufferCache.unpin(page);
-            }
-        }
+			} finally {
+				page.releaseReadLatch();
+				bufferCache.unpin(page);
+			}
+		}
 
-        treeIndexStats.end();
+		treeIndexStats.end();
 
-        bufferCache.closeFile(fileId);
+		bufferCache.closeFile(fileId);
 
-        return treeIndexStats;
-    }
+		return treeIndexStats;
+	}
 }
diff --git a/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/AbstractInvertedIndexOperatorDescriptor.java b/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/AbstractInvertedIndexOperatorDescriptor.java
index 0d0c5bf..9db23ef 100644
--- a/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/AbstractInvertedIndexOperatorDescriptor.java
+++ b/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/AbstractInvertedIndexOperatorDescriptor.java
@@ -21,6 +21,7 @@
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
@@ -93,6 +94,11 @@
     public IBinaryComparatorFactory[] getTreeIndexComparatorFactories() {
         return btreeComparatorFactories;
     }
+    
+    @Override
+    public IPrimitiveValueProviderFactory[] getTreeIndexValueProviderFactories() {
+        return null;
+    }
 
     @Override
     public ITypeTrait[] getTreeIndexTypeTraits() {
@@ -148,4 +154,4 @@
     public ITreeIndexOpHelperFactory getTreeIndexOpHelperFactory() {
         return opHelperFactory;
     }
-}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeFrame.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeFrame.java
index ebc17b5..e3b9b96 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeFrame.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeFrame.java
@@ -25,24 +25,23 @@
 
 public interface IRTreeFrame extends ITreeIndexFrame {
 
-    public ITreeIndexTupleReference createTupleReference();
+	public ITreeIndexTupleReference createTupleReference();
 
-    public void generateDist(ITupleReference tuple, TupleEntryArrayList entries, Rectangle rec, int start, int end);
+	public void computeMBR(ISplitKey splitKey, MultiComparator cmp);
 
-    public void computeMBR(ISplitKey splitKey, MultiComparator cmp);
+	public void insert(ITupleReference tuple, MultiComparator cmp,
+			int tupleIndex) throws Exception;
 
-    public void insert(ITupleReference tuple, MultiComparator cmp, int tupleIndex) throws Exception;
+	public void delete(int tupleIndex, MultiComparator cmp) throws Exception;
 
-    public void delete(int tupleIndex, MultiComparator cmp) throws Exception;
+	public int getPageNsn();
 
-    public int getPageNsn();
+	public void setPageNsn(int pageNsn);
 
-    public void setPageNsn(int pageNsn);
+	public int getRightPage();
 
-    public int getRightPage();
+	public void setRightPage(int rightPage);
 
-    public void setRightPage(int rightPage);
+	public void adjustMBR(ITreeIndexTupleReference[] tuples, MultiComparator cmp);
 
-    public void adjustMBR(ITreeIndexTupleReference[] tuples, MultiComparator cmp);
-
-}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeInteriorFrame.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeInteriorFrame.java
index 824c6b0..4c251d2 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeInteriorFrame.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeInteriorFrame.java
@@ -21,19 +21,23 @@
 
 public interface IRTreeInteriorFrame extends IRTreeFrame {
 
-    public boolean findBestChild(ITupleReference tuple, MultiComparator cmp);
+	public boolean findBestChild(ITupleReference tuple, MultiComparator cmp);
 
-    public int getBestChildPageId(MultiComparator cmp);
+	public int getBestChildPageId(MultiComparator cmp);
 
-    public int getChildPageIdIfIntersect(ITupleReference tuple, int tupleIndex, MultiComparator cmp);
+	public int getChildPageIdIfIntersect(ITupleReference tuple, int tupleIndex,
+			MultiComparator cmp);
 
-    public int findTupleByPointer(ITupleReference tuple, MultiComparator cmp);
+	public int findTupleByPointer(ITupleReference tuple, MultiComparator cmp);
 
-    public int findTupleByPointer(ITupleReference tuple, PathList traverseList, int parentId, MultiComparator cmp);
+	public int findTupleByPointer(ITupleReference tuple, PathList traverseList,
+			int parentId, MultiComparator cmp);
 
-    public void adjustKey(ITupleReference tuple, int tupleIndex, MultiComparator cmp);
+	public void adjustKey(ITupleReference tuple, int tupleIndex,
+			MultiComparator cmp);
 
-    public boolean recomputeMBR(ITupleReference tuple, int tupleIndex, MultiComparator cmp);
+	public boolean recomputeMBR(ITupleReference tuple, int tupleIndex,
+			MultiComparator cmp);
 
-    public void enlarge(ITupleReference tuple, MultiComparator cmp);
+	public void enlarge(ITupleReference tuple, MultiComparator cmp);
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeLeafFrame.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeLeafFrame.java
index c85712d..3005785 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeLeafFrame.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/api/IRTreeLeafFrame.java
@@ -20,7 +20,8 @@
 
 public interface IRTreeLeafFrame extends IRTreeFrame {
 
-    public int findTupleIndex(ITupleReference tuple, MultiComparator cmp);
+	public int findTupleIndex(ITupleReference tuple, MultiComparator cmp);
 
-    public boolean intersect(ITupleReference tuple, int tupleIndex, MultiComparator cmp);
+	public boolean intersect(ITupleReference tuple, int tupleIndex,
+			MultiComparator cmp);
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelper.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelper.java
index 2fcb065..cb7c9d9 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelper.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelper.java
@@ -16,8 +16,10 @@
 package edu.uci.ics.hyracks.storage.am.rtree.dataflow;
 
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.ITreeIndexOperatorDescriptorHelper;
@@ -31,20 +33,32 @@
 
 public class RTreeOpHelper extends TreeIndexOpHelper {
 
-    protected MultiComparator interiorCmp;
+	public RTreeOpHelper(ITreeIndexOperatorDescriptorHelper opDesc,
+			IHyracksTaskContext ctx, int partition, IndexHelperOpenMode mode) {
+		super(opDesc, ctx, partition, mode);
+	}
 
-    public RTreeOpHelper(ITreeIndexOperatorDescriptorHelper opDesc, IHyracksTaskContext ctx, int partition,
-            IndexHelperOpenMode mode) {
-        super(opDesc, ctx, partition, mode);
-    }
+	public ITreeIndex createTreeIndex() throws HyracksDataException {
+		IBufferCache bufferCache = opDesc.getStorageManager().getBufferCache(
+				ctx);
+		ITreeIndexMetaDataFrameFactory metaDataFrameFactory = new LIFOMetaDataFrameFactory();
+		IFreePageManager freePageManager = new LinkedListFreePageManager(
+				bufferCache, indexFileId, 0, metaDataFrameFactory);
 
-    public ITreeIndex createTreeIndex() throws HyracksDataException {
-        IBufferCache bufferCache = opDesc.getStorageManager().getBufferCache(ctx);
-        ITreeIndexMetaDataFrameFactory metaDataFrameFactory = new LIFOMetaDataFrameFactory();
-        IFreePageManager freePageManager = new LinkedListFreePageManager(bufferCache, indexFileId, 0,
-                metaDataFrameFactory);
+		return new RTree(bufferCache, freePageManager,
+				opDesc.getTreeIndexInteriorFactory(),
+				opDesc.getTreeIndexLeafFactory(), cmp);
+	}
 
-        return new RTree(bufferCache, freePageManager, opDesc.getTreeIndexInteriorFactory(),
-                opDesc.getTreeIndexLeafFactory(), cmp);
-    }
-}
+	public MultiComparator createMultiComparator(IBinaryComparator[] comparators)
+			throws HyracksDataException {
+		IPrimitiveValueProvider[] keyValueProvider = new IPrimitiveValueProvider[opDesc
+				.getTreeIndexValueProviderFactories().length];
+		for (int i = 0; i < opDesc.getTreeIndexComparatorFactories().length; i++) {
+			keyValueProvider[i] = opDesc.getTreeIndexValueProviderFactories()[i]
+					.createPrimitiveValueProvider();
+		}
+		return new MultiComparator(opDesc.getTreeIndexTypeTraits(),
+				comparators, keyValueProvider);
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelperFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelperFactory.java
index 75668e1..6afc37e 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelperFactory.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeOpHelperFactory.java
@@ -23,11 +23,12 @@
 
 public class RTreeOpHelperFactory implements ITreeIndexOpHelperFactory {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    @Override
-    public TreeIndexOpHelper createTreeIndexOpHelper(ITreeIndexOperatorDescriptorHelper opDesc,
-            IHyracksTaskContext ctx, int partition, IndexHelperOpenMode mode) {
-        return new RTreeOpHelper(opDesc, ctx, partition, mode);
-    }
+	@Override
+	public TreeIndexOpHelper createTreeIndexOpHelper(
+			ITreeIndexOperatorDescriptorHelper opDesc, IHyracksTaskContext ctx,
+			int partition, IndexHelperOpenMode mode) {
+		return new RTreeOpHelper(opDesc, ctx, partition, mode);
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java
index 3dc0963..f5741c0 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java
@@ -24,6 +24,7 @@
 import edu.uci.ics.hyracks.api.job.IOperatorEnvironment;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor;
@@ -31,25 +32,35 @@
 import edu.uci.ics.hyracks.storage.am.common.dataflow.ITreeIndexOpHelperFactory;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
-public class RTreeSearchOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
+public class RTreeSearchOperatorDescriptor extends
+		AbstractTreeIndexOperatorDescriptor {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    private int[] keyFields; // fields in input tuple to be used as keys
+	private int[] keyFields; // fields in input tuple to be used as keys
 
-    public RTreeSearchOperatorDescriptor(JobSpecification spec, RecordDescriptor recDesc,
-            IStorageManagerInterface storageManager, IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
-            IFileSplitProvider fileSplitProvider, ITreeIndexFrameFactory interiorFrameFactory,
-            ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
-            IBinaryComparatorFactory[] comparatorFactories, int[] keyFields, ITreeIndexOpHelperFactory opHelperFactory) {
-        super(spec, 1, 1, recDesc, storageManager, treeIndexRegistryProvider, fileSplitProvider, interiorFrameFactory,
-                leafFrameFactory, typeTraits, comparatorFactories, opHelperFactory);
-        this.keyFields = keyFields;
-    }
+	public RTreeSearchOperatorDescriptor(JobSpecification spec,
+			RecordDescriptor recDesc, IStorageManagerInterface storageManager,
+			IIndexRegistryProvider<ITreeIndex> treeIndexRegistryProvider,
+			IFileSplitProvider fileSplitProvider,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, ITypeTrait[] typeTraits,
+			IBinaryComparatorFactory[] comparatorFactories,
+			IPrimitiveValueProviderFactory[] valueProviderFactories,
+			int[] keyFields, ITreeIndexOpHelperFactory opHelperFactory) {
+		super(spec, 1, 1, recDesc, storageManager, treeIndexRegistryProvider,
+				fileSplitProvider, interiorFrameFactory, leafFrameFactory,
+				typeTraits, comparatorFactories, valueProviderFactories,
+				opHelperFactory);
+		this.keyFields = keyFields;
+	}
 
-    @Override
-    public IOperatorNodePushable createPushRuntime(final IHyracksTaskContext ctx, final IOperatorEnvironment env,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
-        return new RTreeSearchOperatorNodePushable(this, ctx, partition, recordDescProvider, keyFields);
-    }
-}
+	@Override
+	public IOperatorNodePushable createPushRuntime(
+			final IHyracksTaskContext ctx, final IOperatorEnvironment env,
+			IRecordDescriptorProvider recordDescProvider, int partition,
+			int nPartitions) {
+		return new RTreeSearchOperatorNodePushable(this, ctx, partition,
+				recordDescProvider, keyFields);
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java
index 69e48c0..c9a4d6b 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java
@@ -29,6 +29,7 @@
 import edu.uci.ics.hyracks.dataflow.common.comm.util.FrameUtils;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
 import edu.uci.ics.hyracks.dataflow.std.base.AbstractUnaryInputUnaryOutputOperatorNodePushable;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrame;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor;
@@ -44,138 +45,157 @@
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTreeSearchCursor;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.SearchPredicate;
 
-public class RTreeSearchOperatorNodePushable extends AbstractUnaryInputUnaryOutputOperatorNodePushable {
-    private TreeIndexOpHelper treeIndexOpHelper;
-    private FrameTupleAccessor accessor;
+public class RTreeSearchOperatorNodePushable extends
+		AbstractUnaryInputUnaryOutputOperatorNodePushable {
+	private TreeIndexOpHelper treeIndexOpHelper;
+	private FrameTupleAccessor accessor;
 
-    private ByteBuffer writeBuffer;
-    private FrameTupleAppender appender;
-    private ArrayTupleBuilder tb;
-    private DataOutput dos;
+	private ByteBuffer writeBuffer;
+	private FrameTupleAppender appender;
+	private ArrayTupleBuilder tb;
+	private DataOutput dos;
 
-    private RTree rtree;
-    private PermutingFrameTupleReference searchKey;
-    private SearchPredicate searchPred;
-    private MultiComparator cmp;
-    private ITreeIndexCursor cursor;
-    private ITreeIndexFrame interiorFrame;
-    private ITreeIndexFrame leafFrame;
-    private RTreeOpContext opCtx;
+	private RTree rtree;
+	private PermutingFrameTupleReference searchKey;
+	private SearchPredicate searchPred;
+	private MultiComparator cmp;
+	private ITreeIndexCursor cursor;
+	private ITreeIndexFrame interiorFrame;
+	private ITreeIndexFrame leafFrame;
+	private RTreeOpContext opCtx;
 
-    private RecordDescriptor recDesc;
+	private RecordDescriptor recDesc;
 
-    public RTreeSearchOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc, IHyracksTaskContext ctx,
-            int partition, IRecordDescriptorProvider recordDescProvider, int[] keyFields) {
-        treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory().createTreeIndexOpHelper(opDesc, ctx, partition,
-                IndexHelperOpenMode.OPEN);
+	public RTreeSearchOperatorNodePushable(
+			AbstractTreeIndexOperatorDescriptor opDesc,
+			IHyracksTaskContext ctx, int partition,
+			IRecordDescriptorProvider recordDescProvider, int[] keyFields) {
+		treeIndexOpHelper = opDesc.getTreeIndexOpHelperFactory()
+				.createTreeIndexOpHelper(opDesc, ctx, partition,
+						IndexHelperOpenMode.OPEN);
 
-        this.recDesc = recordDescProvider.getInputRecordDescriptor(opDesc.getOperatorId(), 0);
-        if (keyFields != null && keyFields.length > 0) {
-            searchKey = new PermutingFrameTupleReference();
-            searchKey.setFieldPermutation(keyFields);
-        }
-    }
+		this.recDesc = recordDescProvider.getInputRecordDescriptor(
+				opDesc.getOperatorId(), 0);
+		if (keyFields != null && keyFields.length > 0) {
+			searchKey = new PermutingFrameTupleReference();
+			searchKey.setFieldPermutation(keyFields);
+		}
+	}
 
-    @Override
-    public void open() throws HyracksDataException {
-        AbstractTreeIndexOperatorDescriptor opDesc = (AbstractTreeIndexOperatorDescriptor) treeIndexOpHelper
-                .getOperatorDescriptor();
-        accessor = new FrameTupleAccessor(treeIndexOpHelper.getHyracksTaskContext().getFrameSize(), recDesc);
+	@Override
+	public void open() throws HyracksDataException {
+		AbstractTreeIndexOperatorDescriptor opDesc = (AbstractTreeIndexOperatorDescriptor) treeIndexOpHelper
+				.getOperatorDescriptor();
+		accessor = new FrameTupleAccessor(treeIndexOpHelper
+				.getHyracksTaskContext().getFrameSize(), recDesc);
 
-        interiorFrame = opDesc.getTreeIndexInteriorFactory().createFrame();
-        leafFrame = opDesc.getTreeIndexLeafFactory().createFrame();
-        cursor = new RTreeSearchCursor((IRTreeInteriorFrame) interiorFrame, (IRTreeLeafFrame) leafFrame);
+		interiorFrame = opDesc.getTreeIndexInteriorFactory().createFrame();
+		leafFrame = opDesc.getTreeIndexLeafFactory().createFrame();
+		cursor = new RTreeSearchCursor((IRTreeInteriorFrame) interiorFrame,
+				(IRTreeLeafFrame) leafFrame);
 
-        writer.open();
+		try {
 
-        try {
+			treeIndexOpHelper.init();
+			rtree = (RTree) treeIndexOpHelper.getTreeIndex();
 
-            treeIndexOpHelper.init();
-            rtree = (RTree) treeIndexOpHelper.getTreeIndex();
+			int keySearchFields = rtree.getCmp().getComparators().length;
 
-            int keySearchFields = rtree.getCmp().getComparators().length;
+			IBinaryComparator[] keySearchComparators = new IBinaryComparator[keySearchFields];
+			for (int i = 0; i < keySearchFields; i++) {
+				keySearchComparators[i] = rtree.getCmp().getComparators()[i];
+			}
 
-            IBinaryComparator[] keySearchComparators = new IBinaryComparator[keySearchFields];
-            for (int i = 0; i < keySearchFields; i++) {
-                keySearchComparators[i] = rtree.getCmp().getComparators()[i];
-            }
-            cmp = new MultiComparator(rtree.getCmp().getTypeTraits(), keySearchComparators);
-            searchPred = new SearchPredicate(searchKey, cmp);
+			IPrimitiveValueProvider[] keyValueProvider = new IPrimitiveValueProvider[keySearchFields];
+			for (int i = 0; i < keySearchFields; i++) {
+				keyValueProvider[i] = rtree.getCmp().getValueProviders()[i];
+			}
 
-            writeBuffer = treeIndexOpHelper.getHyracksTaskContext().allocateFrame();
-            tb = new ArrayTupleBuilder(rtree.getCmp().getFieldCount());
-            dos = tb.getDataOutput();
-            appender = new FrameTupleAppender(treeIndexOpHelper.getHyracksTaskContext().getFrameSize());
-            appender.reset(writeBuffer, true);
+			cmp = new MultiComparator(rtree.getCmp().getTypeTraits(),
+					keySearchComparators, keyValueProvider);
 
-            opCtx = rtree.createOpContext(IndexOp.SEARCH, treeIndexOpHelper.getLeafFrame(),
-                    treeIndexOpHelper.getInteriorFrame(), null);
+			searchPred = new SearchPredicate(searchKey, cmp);
 
-        } catch (Exception e) {
-            treeIndexOpHelper.deinit();
-            throw new HyracksDataException(e);
-        }
-    }
+			writeBuffer = treeIndexOpHelper.getHyracksTaskContext()
+					.allocateFrame();
+			tb = new ArrayTupleBuilder(rtree.getCmp().getFieldCount());
+			dos = tb.getDataOutput();
+			appender = new FrameTupleAppender(treeIndexOpHelper
+					.getHyracksTaskContext().getFrameSize());
+			appender.reset(writeBuffer, true);
 
-    private void writeSearchResults() throws Exception {
-        while (cursor.hasNext()) {
-            tb.reset();
-            cursor.next();
+			opCtx = rtree.createOpContext(IndexOp.SEARCH,
+					treeIndexOpHelper.getLeafFrame(),
+					treeIndexOpHelper.getInteriorFrame(), null);
 
-            ITupleReference frameTuple = cursor.getTuple();
-            for (int i = 0; i < frameTuple.getFieldCount(); i++) {
-                dos.write(frameTuple.getFieldData(i), frameTuple.getFieldStart(i), frameTuple.getFieldLength(i));
-                tb.addFieldEndOffset();
-            }
+		} catch (Exception e) {
+			treeIndexOpHelper.deinit();
+		}
+	}
 
-            if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
-                FrameUtils.flushFrame(writeBuffer, writer);
-                appender.reset(writeBuffer, true);
-                if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
-                    throw new IllegalStateException();
-                }
-            }
-        }
-    }
+	private void writeSearchResults() throws Exception {
+		while (cursor.hasNext()) {
+			tb.reset();
+			cursor.next();
 
-    @Override
-    public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
-        accessor.reset(buffer);
+			ITupleReference frameTuple = cursor.getTuple();
+			for (int i = 0; i < frameTuple.getFieldCount(); i++) {
+				dos.write(frameTuple.getFieldData(i),
+						frameTuple.getFieldStart(i),
+						frameTuple.getFieldLength(i));
+				tb.addFieldEndOffset();
+			}
 
-        int tupleCount = accessor.getTupleCount();
-        try {
-            for (int i = 0; i < tupleCount; i++) {
-                searchKey.reset(accessor, i);
+			if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0,
+					tb.getSize())) {
+				FrameUtils.flushFrame(writeBuffer, writer);
+				appender.reset(writeBuffer, true);
+				if (!appender.append(tb.getFieldEndOffsets(),
+						tb.getByteArray(), 0, tb.getSize())) {
+					throw new IllegalStateException();
+				}
+			}
+		}
+	}
 
-                searchPred.setSearchKey(searchKey);
-                cursor.reset();
-                rtree.search(cursor, searchPred, opCtx);
-                writeSearchResults();
-            }
-        } catch (Exception e) {
-            throw new HyracksDataException(e);
-        }
-    }
+	@Override
+	public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
+		accessor.reset(buffer);
 
-    @Override
-    public void close() throws HyracksDataException {
-        try {
-            if (appender.getTupleCount() > 0) {
-                FrameUtils.flushFrame(writeBuffer, writer);
-            }
-            writer.close();
-            try {
-                cursor.close();
-            } catch (Exception e) {
-                throw new HyracksDataException(e);
-            }
-        } finally {
-            treeIndexOpHelper.deinit();
-        }
-    }
+		int tupleCount = accessor.getTupleCount();
+		try {
+			for (int i = 0; i < tupleCount; i++) {
+				searchKey.reset(accessor, i);
 
-    @Override
-    public void fail() throws HyracksDataException {
-        writer.fail();
-    }
+				searchPred.setSearchKey(searchKey);
+				cursor.reset();
+				rtree.search(cursor, searchPred, opCtx);
+				writeSearchResults();
+			}
+		} catch (Exception e) {
+			throw new HyracksDataException(e);
+		}
+	}
+
+	@Override
+	public void close() throws HyracksDataException {
+		try {
+			if (appender.getTupleCount() > 0) {
+				FrameUtils.flushFrame(writeBuffer, writer);
+			}
+			writer.close();
+			try {
+				cursor.close();
+			} catch (Exception e) {
+				throw new HyracksDataException(e);
+			}
+		} finally {
+			treeIndexOpHelper.deinit();
+		}
+	}
+
+	@Override
+	public void fail() throws HyracksDataException {
+		writer.fail();
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java
index 63870df..e809884 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java
@@ -17,21 +17,14 @@
 
 import java.util.ArrayList;
 
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
-import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
-import edu.uci.ics.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.common.api.ISplitKey;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleReference;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriter;
 import edu.uci.ics.hyracks.storage.am.common.frames.TreeIndexNSMFrame;
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
-import edu.uci.ics.hyracks.storage.am.rtree.api.IGenericPrimitiveSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeFrame;
-import edu.uci.ics.hyracks.storage.am.rtree.impls.DoubleGenericPrimitiveSerializerDeserializer;
-import edu.uci.ics.hyracks.storage.am.rtree.impls.FloatGenericPrimitiveSerializerDeserializer;
-import edu.uci.ics.hyracks.storage.am.rtree.impls.IntegerGenericPrimitiveSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTreeSplitKey;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.Rectangle;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.TupleEntryArrayList;
@@ -50,35 +43,17 @@
 	protected TupleEntryArrayList tupleEntries2; // used for split
 
 	protected Rectangle[] rec;
-	protected IGenericPrimitiveSerializerDeserializer[] recDescSers;
 
 	protected static final double splitFactor = 0.4;
 	protected static final int nearMinimumOverlapFactor = 32;
 	private static final double doubleEpsilon = computeDoubleEpsilon();
 	private static final int numTuplesEntries = 100;
 
-	public RTreeNSMFrame(ITreeIndexTupleWriter tupleWriter,
-			ISerializerDeserializer[] recDescSers, int keyFieldCount) {
+	public RTreeNSMFrame(ITreeIndexTupleWriter tupleWriter, int keyFieldCount) {
 		super(tupleWriter, new UnorderedSlotManager());
 		this.tuples = new ITreeIndexTupleReference[keyFieldCount];
-		this.recDescSers = new IGenericPrimitiveSerializerDeserializer[keyFieldCount];
 		for (int i = 0; i < keyFieldCount; i++) {
 			this.tuples[i] = tupleWriter.createTupleReference();
-
-			if (recDescSers[i].getClass().equals(
-					IntegerSerializerDeserializer.INSTANCE.getClass())) {
-				this.recDescSers[i] = IntegerGenericPrimitiveSerializerDeserializer.INSTANCE;
-			} else if (recDescSers[i].getClass().equals(
-					FloatSerializerDeserializer.INSTANCE.getClass())) {
-				this.recDescSers[i] = FloatGenericPrimitiveSerializerDeserializer.INSTANCE;
-			} else if (recDescSers[i].getClass().equals(
-					DoubleSerializerDeserializer.INSTANCE.getClass())) {
-				this.recDescSers[i] = DoubleGenericPrimitiveSerializerDeserializer.INSTANCE;
-			} else {
-				throw new RuntimeException(
-						"Key type not supported. The supported key types are int, float, and double ");
-
-			}
 		}
 		cmpFrameTuple = tupleWriter.createTupleReference();
 
@@ -88,7 +63,7 @@
 				numTuplesEntries);
 		rec = new Rectangle[4];
 		for (int i = 0; i < 4; i++) {
-			rec[i] = new Rectangle(keyFieldCount / 2, this.recDescSers);
+			rec[i] = new Rectangle(keyFieldCount / 2);
 		}
 	}
 
@@ -166,21 +141,22 @@
 	}
 
 	public void generateDist(ITupleReference tuple,
-			TupleEntryArrayList entries, Rectangle rec, int start, int end) {
+			TupleEntryArrayList entries, Rectangle rec, int start, int end,
+			MultiComparator cmp) {
 		int j = 0;
 		while (entries.get(j).getTupleIndex() == -1) {
 			j++;
 		}
 		frameTuple.resetByTupleIndex(this, entries.get(j).getTupleIndex());
-		rec.set(frameTuple);
+		rec.set(frameTuple, cmp);
 		for (int i = start; i < end; ++i) {
 			if (i != j) {
 				if (entries.get(i).getTupleIndex() != -1) {
 					frameTuple.resetByTupleIndex(this, entries.get(i)
 							.getTupleIndex());
-					rec.enlarge(frameTuple);
+					rec.enlarge(frameTuple, cmp);
 				} else {
-					rec.enlarge(tuple);
+					rec.enlarge(tuple, cmp);
 				}
 			}
 		}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java
index d7ddf66..38d2a46 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java
@@ -46,8 +46,8 @@
 	private static final int childPtrSize = 4;
 
 	public RTreeNSMInteriorFrame(ITreeIndexTupleWriter tupleWriter,
-			ISerializerDeserializer[] recDescSers, int keyFieldCount) {
-		super(tupleWriter, recDescSers, keyFieldCount);
+			int keyFieldCount) {
+		super(tupleWriter, keyFieldCount);
 	}
 
 	@Override
@@ -219,7 +219,6 @@
 				return -1;
 			}
 		}
-		// return buf.getInt(frameTuple.getFieldStart(cmp.getKeyFieldCount()));
 		return buf.getInt(getChildPointerOff(frameTuple, cmp));
 	}
 
@@ -347,21 +346,20 @@
 			for (int k = 0; k < getTupleCount(); ++k) {
 
 				frameTuple.resetByTupleIndex(this, k);
-
-				double LowerKey = recDescSers[i]
+				double LowerKey = cmp.getValueProviders()[i]
 						.getValue(frameTuple.getFieldData(i),
 								frameTuple.getFieldStart(i));
-				double UpperKey = recDescSers[j]
+				double UpperKey = cmp.getValueProviders()[j]
 						.getValue(frameTuple.getFieldData(j),
 								frameTuple.getFieldStart(j));
 
 				tupleEntries1.add(k, LowerKey);
 				tupleEntries2.add(k, UpperKey);
 			}
-			double LowerKey = recDescSers[i].getValue(tuple.getFieldData(i),
-					tuple.getFieldStart(i));
-			double UpperKey = recDescSers[j].getValue(tuple.getFieldData(j),
-					tuple.getFieldStart(j));
+			double LowerKey = cmp.getValueProviders()[i].getValue(
+					tuple.getFieldData(i), tuple.getFieldStart(i));
+			double UpperKey = cmp.getValueProviders()[j].getValue(
+					tuple.getFieldData(j), tuple.getFieldStart(j));
 
 			tupleEntries1.add(-1, LowerKey);
 			tupleEntries2.add(-1, UpperKey);
@@ -374,12 +372,12 @@
 			for (int k = 1; k <= splitDistribution; ++k) {
 				int d = m - 1 + k;
 
-				generateDist(tuple, tupleEntries1, rec[0], 0, d);
-				generateDist(tuple, tupleEntries2, rec[1], 0, d);
+				generateDist(tuple, tupleEntries1, rec[0], 0, d, cmp);
+				generateDist(tuple, tupleEntries2, rec[1], 0, d, cmp);
 				generateDist(tuple, tupleEntries1, rec[2], d,
-						getTupleCount() + 1);
+						getTupleCount() + 1, cmp);
 				generateDist(tuple, tupleEntries2, rec[3], d,
-						getTupleCount() + 1);
+						getTupleCount() + 1, cmp);
 
 				// calculate the margin of the distributions
 				lowerMargin += rec[0].margin() + rec[2].margin();
@@ -400,12 +398,12 @@
 
 		for (int i = 0; i < getTupleCount(); ++i) {
 			frameTuple.resetByTupleIndex(this, i);
-			double key = recDescSers[splitAxis + sortOrder].getValue(
-					frameTuple.getFieldData(splitAxis + sortOrder),
-					frameTuple.getFieldStart(splitAxis + sortOrder));
+			double key = cmp.getValueProviders()[splitAxis + sortOrder]
+					.getValue(frameTuple.getFieldData(splitAxis + sortOrder),
+							frameTuple.getFieldStart(splitAxis + sortOrder));
 			tupleEntries1.add(i, key);
 		}
-		double key = recDescSers[splitAxis + sortOrder].getValue(
+		double key = cmp.getValueProviders()[splitAxis + sortOrder].getValue(
 				tuple.getFieldData(splitAxis + sortOrder),
 				tuple.getFieldStart(splitAxis + sortOrder));
 		tupleEntries1.add(-1, key);
@@ -417,8 +415,9 @@
 		for (int i = 1; i <= splitDistribution; ++i) {
 			int d = m - 1 + i;
 
-			generateDist(tuple, tupleEntries1, rec[0], 0, d);
-			generateDist(tuple, tupleEntries1, rec[2], d, getTupleCount() + 1);
+			generateDist(tuple, tupleEntries1, rec[0], 0, d, cmp);
+			generateDist(tuple, tupleEntries1, rec[2], d, getTupleCount() + 1,
+					cmp);
 
 			double overlap = rec[0].overlappedArea(rec[2]);
 			if (overlap < minOverlap) {
@@ -589,10 +588,10 @@
 						tupleToBeInserted.getFieldStart(i),
 						tupleToBeInserted.getFieldLength(i));
 				if (c < 0) {
-					pLow1 = recDescSers[i].getValue(tuple1.getFieldData(i),
-							tuple1.getFieldStart(i));
+					pLow1 = cmp.getValueProviders()[i].getValue(
+							tuple1.getFieldData(i), tuple1.getFieldStart(i));
 				} else {
-					pLow1 = recDescSers[i].getValue(
+					pLow1 = cmp.getValueProviders()[i].getValue(
 							tupleToBeInserted.getFieldData(i),
 							tupleToBeInserted.getFieldStart(i));
 				}
@@ -603,24 +602,24 @@
 						tupleToBeInserted.getFieldStart(j),
 						tupleToBeInserted.getFieldLength(j));
 				if (c > 0) {
-					pHigh1 = recDescSers[j].getValue(tuple1.getFieldData(j),
-							tuple1.getFieldStart(j));
+					pHigh1 = cmp.getValueProviders()[j].getValue(
+							tuple1.getFieldData(j), tuple1.getFieldStart(j));
 				} else {
-					pHigh1 = recDescSers[j].getValue(
+					pHigh1 = cmp.getValueProviders()[j].getValue(
 							tupleToBeInserted.getFieldData(j),
 							tupleToBeInserted.getFieldStart(j));
 				}
 			} else {
-				pLow1 = recDescSers[i].getValue(tuple1.getFieldData(i),
-						tuple1.getFieldStart(i));
-				pHigh1 = recDescSers[j].getValue(tuple1.getFieldData(j),
-						tuple1.getFieldStart(j));
+				pLow1 = cmp.getValueProviders()[i].getValue(
+						tuple1.getFieldData(i), tuple1.getFieldStart(i));
+				pHigh1 = cmp.getValueProviders()[j].getValue(
+						tuple1.getFieldData(j), tuple1.getFieldStart(j));
 			}
 
-			double pLow2 = recDescSers[i].getValue(tuple2.getFieldData(i),
-					tuple2.getFieldStart(i));
-			double pHigh2 = recDescSers[j].getValue(tuple2.getFieldData(j),
-					tuple2.getFieldStart(j));
+			double pLow2 = cmp.getValueProviders()[i].getValue(
+					tuple2.getFieldData(i), tuple2.getFieldStart(i));
+			double pHigh2 = cmp.getValueProviders()[j].getValue(
+					tuple2.getFieldData(j), tuple2.getFieldStart(j));
 
 			if (pLow1 > pHigh2 || pHigh1 < pLow2) {
 				return 0.0;
@@ -648,10 +647,10 @@
 					tupleToBeInserted.getFieldStart(i),
 					tupleToBeInserted.getFieldLength(i));
 			if (c < 0) {
-				pLow = recDescSers[i].getValue(tuple.getFieldData(i),
-						tuple.getFieldStart(i));
+				pLow = cmp.getValueProviders()[i].getValue(
+						tuple.getFieldData(i), tuple.getFieldStart(i));
 			} else {
-				pLow = recDescSers[i].getValue(
+				pLow = cmp.getValueProviders()[i].getValue(
 						tupleToBeInserted.getFieldData(i),
 						tupleToBeInserted.getFieldStart(i));
 			}
@@ -662,10 +661,10 @@
 					tupleToBeInserted.getFieldStart(j),
 					tupleToBeInserted.getFieldLength(j));
 			if (c > 0) {
-				pHigh = recDescSers[j].getValue(tuple.getFieldData(j),
-						tuple.getFieldStart(j));
+				pHigh = cmp.getValueProviders()[j].getValue(
+						tuple.getFieldData(j), tuple.getFieldStart(j));
 			} else {
-				pHigh = recDescSers[j].getValue(
+				pHigh = cmp.getValueProviders()[j].getValue(
 						tupleToBeInserted.getFieldData(j),
 						tupleToBeInserted.getFieldStart(j));
 			}
@@ -679,10 +678,10 @@
 		int maxFieldPos = cmp.getKeyFieldCount() / 2;
 		for (int i = 0; i < maxFieldPos; i++) {
 			int j = maxFieldPos + i;
-			area *= recDescSers[j].getValue(tuple.getFieldData(j),
+			area *= cmp.getValueProviders()[j].getValue(tuple.getFieldData(j),
 					tuple.getFieldStart(j))
-					- recDescSers[i].getValue(tuple.getFieldData(i),
-							tuple.getFieldStart(i));
+					- cmp.getValueProviders()[i].getValue(
+							tuple.getFieldData(i), tuple.getFieldStart(i));
 		}
 		return area;
 	}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrameFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrameFactory.java
index 004c519..100b4d8 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrameFactory.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrameFactory.java
@@ -15,7 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.rtree.frames;
 
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeInteriorFrame;
@@ -24,21 +23,21 @@
 
 	private static final long serialVersionUID = 1L;
 	private ITreeIndexTupleWriterFactory tupleWriterFactory;
-	private ISerializerDeserializer[] recDescSers;
 	private int keyFieldCount;
 
 	public RTreeNSMInteriorFrameFactory(
-			ITreeIndexTupleWriterFactory tupleWriterFactory,
-			ISerializerDeserializer[] recDescSers, int keyFieldCount) {
+			ITreeIndexTupleWriterFactory tupleWriterFactory, int keyFieldCount) {
 		this.tupleWriterFactory = tupleWriterFactory;
-		this.recDescSers = recDescSers;
+		if (keyFieldCount % 2 != 0) {
+			throw new IllegalArgumentException(
+					"The key has different number of dimensions.");
+		}
 		this.keyFieldCount = keyFieldCount;
 	}
 
 	@Override
 	public IRTreeInteriorFrame createFrame() {
 		return new RTreeNSMInteriorFrame(
-				tupleWriterFactory.createTupleWriter(), recDescSers,
-				keyFieldCount);
+				tupleWriterFactory.createTupleWriter(), keyFieldCount);
 	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java
index 29536a8..fa2ad32 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java
@@ -15,7 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.rtree.frames;
 
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
 import edu.uci.ics.hyracks.storage.am.common.api.ISplitKey;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrame;
@@ -32,8 +31,8 @@
 public class RTreeNSMLeafFrame extends RTreeNSMFrame implements IRTreeLeafFrame {
 
 	public RTreeNSMLeafFrame(ITreeIndexTupleWriter tupleWriter,
-			ISerializerDeserializer[] recDescSers, int keyFieldCount) {
-		super(tupleWriter, recDescSers, keyFieldCount);
+			int keyFieldCount) {
+		super(tupleWriter, keyFieldCount);
 	}
 
 	@Override
@@ -96,20 +95,20 @@
 
 				frameTuple.resetByTupleIndex(this, k);
 
-				double LowerKey = recDescSers[i]
+				double LowerKey = cmp.getValueProviders()[i]
 						.getValue(frameTuple.getFieldData(i),
 								frameTuple.getFieldStart(i));
-				double UpperKey = recDescSers[j]
+				double UpperKey = cmp.getValueProviders()[j]
 						.getValue(frameTuple.getFieldData(j),
 								frameTuple.getFieldStart(j));
 
 				tupleEntries1.add(k, LowerKey);
 				tupleEntries2.add(k, UpperKey);
 			}
-			double LowerKey = recDescSers[i].getValue(tuple.getFieldData(i),
-					tuple.getFieldStart(i));
-			double UpperKey = recDescSers[j].getValue(tuple.getFieldData(j),
-					tuple.getFieldStart(j));
+			double LowerKey = cmp.getValueProviders()[i].getValue(
+					tuple.getFieldData(i), tuple.getFieldStart(i));
+			double UpperKey = cmp.getValueProviders()[j].getValue(
+					tuple.getFieldData(j), tuple.getFieldStart(j));
 
 			tupleEntries1.add(-1, LowerKey);
 			tupleEntries2.add(-1, UpperKey);
@@ -122,12 +121,12 @@
 			for (int k = 1; k <= splitDistribution; ++k) {
 				int d = m - 1 + k;
 
-				generateDist(tuple, tupleEntries1, rec[0], 0, d);
-				generateDist(tuple, tupleEntries2, rec[1], 0, d);
+				generateDist(tuple, tupleEntries1, rec[0], 0, d, cmp);
+				generateDist(tuple, tupleEntries2, rec[1], 0, d, cmp);
 				generateDist(tuple, tupleEntries1, rec[2], d,
-						getTupleCount() + 1);
+						getTupleCount() + 1, cmp);
 				generateDist(tuple, tupleEntries2, rec[3], d,
-						getTupleCount() + 1);
+						getTupleCount() + 1, cmp);
 
 				// calculate the margin of the distributions
 				lowerMargin += rec[0].margin() + rec[2].margin();
@@ -148,12 +147,12 @@
 
 		for (int i = 0; i < getTupleCount(); ++i) {
 			frameTuple.resetByTupleIndex(this, i);
-			double key = recDescSers[splitAxis + sortOrder].getValue(
-					frameTuple.getFieldData(splitAxis + sortOrder),
-					frameTuple.getFieldStart(splitAxis + sortOrder));
+			double key = cmp.getValueProviders()[splitAxis + sortOrder]
+					.getValue(frameTuple.getFieldData(splitAxis + sortOrder),
+							frameTuple.getFieldStart(splitAxis + sortOrder));
 			tupleEntries1.add(i, key);
 		}
-		double key = recDescSers[splitAxis + sortOrder].getValue(
+		double key = cmp.getValueProviders()[splitAxis + sortOrder].getValue(
 				tuple.getFieldData(splitAxis + sortOrder),
 				tuple.getFieldStart(splitAxis + sortOrder));
 		tupleEntries1.add(-1, key);
@@ -165,8 +164,9 @@
 		for (int i = 1; i <= splitDistribution; ++i) {
 			int d = m - 1 + i;
 
-			generateDist(tuple, tupleEntries1, rec[0], 0, d);
-			generateDist(tuple, tupleEntries1, rec[2], d, getTupleCount() + 1);
+			generateDist(tuple, tupleEntries1, rec[0], 0, d, cmp);
+			generateDist(tuple, tupleEntries1, rec[2], d, getTupleCount() + 1,
+					cmp);
 
 			double overlap = rec[0].overlappedArea(rec[2]);
 			if (overlap < minOverlap) {
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrameFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrameFactory.java
index a470623..51a047e 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrameFactory.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrameFactory.java
@@ -15,7 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.rtree.frames;
 
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriterFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeLeafFrame;
@@ -24,20 +23,21 @@
 
 	private static final long serialVersionUID = 1L;
 	private ITreeIndexTupleWriterFactory tupleWriterFactory;
-	private ISerializerDeserializer[] recDescSers;
 	private int keyFieldCount;
 
 	public RTreeNSMLeafFrameFactory(
-			ITreeIndexTupleWriterFactory tupleWriterFactory,
-			ISerializerDeserializer[] recDescSers, int keyFieldCount) {
+			ITreeIndexTupleWriterFactory tupleWriterFactory, int keyFieldCount) {
 		this.tupleWriterFactory = tupleWriterFactory;
-		this.recDescSers = recDescSers;
+		if (keyFieldCount % 2 != 0) {
+			throw new IllegalArgumentException(
+					"The key has different number of dimensions.");
+		}
 		this.keyFieldCount = keyFieldCount;
 	}
 
 	@Override
 	public IRTreeLeafFrame createFrame() {
 		return new RTreeNSMLeafFrame(tupleWriterFactory.createTupleWriter(),
-				recDescSers, keyFieldCount);
+				keyFieldCount);
 	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/DoubleGenericPrimitiveSerializerDeserializer.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/DoubleGenericPrimitiveSerializerDeserializer.java
deleted file mode 100644
index c24eef4..0000000
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/DoubleGenericPrimitiveSerializerDeserializer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package edu.uci.ics.hyracks.storage.am.rtree.impls;
-
-import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
-import edu.uci.ics.hyracks.storage.am.rtree.api.IGenericPrimitiveSerializerDeserializer;
-
-public class DoubleGenericPrimitiveSerializerDeserializer extends
-		DoubleSerializerDeserializer implements
-		IGenericPrimitiveSerializerDeserializer<Double> {
-
-	private static final long serialVersionUID = 1L;
-
-	public static final DoubleGenericPrimitiveSerializerDeserializer INSTANCE = new DoubleGenericPrimitiveSerializerDeserializer();
-
-	@Override
-	public double getValue(byte[] bytes, int offset) {
-		return DoubleSerializerDeserializer.getDouble(bytes, offset);
-	}
-
-}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/DoublePrimitiveValueProviderFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/DoublePrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..a590ef5
--- /dev/null
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/DoublePrimitiveValueProviderFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.storage.am.rtree.impls;
+
+import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
+
+public class DoublePrimitiveValueProviderFactory implements
+		IPrimitiveValueProviderFactory {
+	private static final long serialVersionUID = 1L;
+
+	public static final DoublePrimitiveValueProviderFactory INSTANCE = new DoublePrimitiveValueProviderFactory();
+
+	private DoublePrimitiveValueProviderFactory() {
+	}
+
+	@Override
+	public IPrimitiveValueProvider createPrimitiveValueProvider() {
+		return new IPrimitiveValueProvider() {
+			@Override
+			public double getValue(byte[] bytes, int offset) {
+				return DoubleSerializerDeserializer.getDouble(bytes, offset);
+			}
+		};
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/EntriesOrder.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/EntriesOrder.java
index 8dce1ac..91fca6a 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/EntriesOrder.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/EntriesOrder.java
@@ -16,5 +16,5 @@
 package edu.uci.ics.hyracks.storage.am.rtree.impls;
 
 public enum EntriesOrder {
-    ASCENDING, DESCENDING
+	ASCENDING, DESCENDING
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/FloatGenericPrimitiveSerializerDeserializer.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/FloatGenericPrimitiveSerializerDeserializer.java
deleted file mode 100644
index 4a2fac6..0000000
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/FloatGenericPrimitiveSerializerDeserializer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package edu.uci.ics.hyracks.storage.am.rtree.impls;
-
-import edu.uci.ics.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer;
-import edu.uci.ics.hyracks.storage.am.rtree.api.IGenericPrimitiveSerializerDeserializer;
-
-public class FloatGenericPrimitiveSerializerDeserializer extends
-		FloatSerializerDeserializer implements
-		IGenericPrimitiveSerializerDeserializer<Float> {
-
-	private static final long serialVersionUID = 1L;
-
-	public static final FloatGenericPrimitiveSerializerDeserializer INSTANCE = new FloatGenericPrimitiveSerializerDeserializer();
-
-	@Override
-	public double getValue(byte[] bytes, int offset) {
-		return FloatSerializerDeserializer.getFloat(bytes, offset);
-	}
-
-}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/FloatPrimitiveValueProviderFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/FloatPrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..605f73a
--- /dev/null
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/FloatPrimitiveValueProviderFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.storage.am.rtree.impls;
+
+import edu.uci.ics.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
+
+public class FloatPrimitiveValueProviderFactory implements
+		IPrimitiveValueProviderFactory {
+	private static final long serialVersionUID = 1L;
+
+	public static final FloatPrimitiveValueProviderFactory INSTANCE = new FloatPrimitiveValueProviderFactory();
+
+	private FloatPrimitiveValueProviderFactory() {
+	}
+
+	@Override
+	public IPrimitiveValueProvider createPrimitiveValueProvider() {
+		return new IPrimitiveValueProvider() {
+			@Override
+			public double getValue(byte[] bytes, int offset) {
+				return FloatSerializerDeserializer.getFloat(bytes, offset);
+			}
+		};
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/IntegerGenericPrimitiveSerializerDeserializer.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/IntegerGenericPrimitiveSerializerDeserializer.java
deleted file mode 100644
index 835d911..0000000
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/IntegerGenericPrimitiveSerializerDeserializer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package edu.uci.ics.hyracks.storage.am.rtree.impls;
-
-import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
-import edu.uci.ics.hyracks.storage.am.rtree.api.IGenericPrimitiveSerializerDeserializer;
-
-public class IntegerGenericPrimitiveSerializerDeserializer extends
-		IntegerSerializerDeserializer implements
-		IGenericPrimitiveSerializerDeserializer<Integer> {
-
-	private static final long serialVersionUID = 1L;
-
-	public static final IntegerGenericPrimitiveSerializerDeserializer INSTANCE = new IntegerGenericPrimitiveSerializerDeserializer();
-
-	@Override
-	public double getValue(byte[] bytes, int offset) {
-		return IntegerSerializerDeserializer.getInt(bytes, offset);
-	}
-
-}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/IntegerPrimitiveValueProviderFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/IntegerPrimitiveValueProviderFactory.java
new file mode 100644
index 0000000..d1457db
--- /dev/null
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/IntegerPrimitiveValueProviderFactory.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.storage.am.rtree.impls;
+
+import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
+
+public class IntegerPrimitiveValueProviderFactory implements
+		IPrimitiveValueProviderFactory {
+	private static final long serialVersionUID = 1L;
+
+	public static final IntegerPrimitiveValueProviderFactory INSTANCE = new IntegerPrimitiveValueProviderFactory();
+
+	private IntegerPrimitiveValueProviderFactory() {
+	}
+
+	@Override
+	public IPrimitiveValueProvider createPrimitiveValueProvider() {
+		return new IPrimitiveValueProvider() {
+			@Override
+			public double getValue(byte[] bytes, int offset) {
+				return IntegerSerializerDeserializer.getInt(bytes, offset);
+			}
+		};
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/PathList.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/PathList.java
index 58bad69..d66d0a0 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/PathList.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/PathList.java
@@ -18,93 +18,93 @@
 import edu.uci.ics.hyracks.storage.am.common.ophelpers.IntArrayList;
 
 public class PathList {
-    private IntArrayList pageIds;
-    private IntArrayList pageLsns;
-    private IntArrayList pageIndexes;
+	private IntArrayList pageIds;
+	private IntArrayList pageLsns;
+	private IntArrayList pageIndexes;
 
-    public PathList(int initialCapacity, int growth) {
-        pageIds = new IntArrayList(initialCapacity, growth);
-        pageLsns = new IntArrayList(initialCapacity, growth);
-        pageIndexes = new IntArrayList(initialCapacity, growth);
-    }
+	public PathList(int initialCapacity, int growth) {
+		pageIds = new IntArrayList(initialCapacity, growth);
+		pageLsns = new IntArrayList(initialCapacity, growth);
+		pageIndexes = new IntArrayList(initialCapacity, growth);
+	}
 
-    public int size() {
-        return pageIds.size();
-    }
+	public int size() {
+		return pageIds.size();
+	}
 
-    public int first() {
-        return pageIds.first();
-    }
+	public int first() {
+		return pageIds.first();
+	}
 
-    public void add(int pageId, int pageLsn, int pageIndex) {
-        pageIds.add(pageId);
-        pageLsns.add(pageLsn);
-        pageIndexes.add(pageIndex);
-    }
+	public void add(int pageId, int pageLsn, int pageIndex) {
+		pageIds.add(pageId);
+		pageLsns.add(pageLsn);
+		pageIndexes.add(pageIndex);
+	}
 
-    public int getFirstPageId() {
-        return pageIds.getFirst();
-    }
+	public int getFirstPageId() {
+		return pageIds.getFirst();
+	}
 
-    public int getFirstPageLsn() {
-        return pageLsns.getFirst();
-    }
+	public int getFirstPageLsn() {
+		return pageLsns.getFirst();
+	}
 
-    public int getFirstPageIndex() {
-        return pageIndexes.getFirst();
-    }
+	public int getFirstPageIndex() {
+		return pageIndexes.getFirst();
+	}
 
-    public int getLastPageId() {
-        return pageIds.getLast();
-    }
+	public int getLastPageId() {
+		return pageIds.getLast();
+	}
 
-    public int getLastPageLsn() {
-        return pageLsns.getLast();
-    }
+	public int getLastPageLsn() {
+		return pageLsns.getLast();
+	}
 
-    public int getLastPageIndex() {
-        return pageIndexes.getLast();
-    }
+	public int getLastPageIndex() {
+		return pageIndexes.getLast();
+	}
 
-    public int getPageId(int i) {
-        return pageIds.get(i);
-    }
+	public int getPageId(int i) {
+		return pageIds.get(i);
+	}
 
-    public int getPageLsn(int i) {
-        return pageLsns.get(i);
-    }
+	public int getPageLsn(int i) {
+		return pageLsns.get(i);
+	}
 
-    public int getPageIndex(int i) {
-        return pageIndexes.get(i);
-    }
+	public int getPageIndex(int i) {
+		return pageIndexes.get(i);
+	}
 
-    public void setPageLsn(int i, int pageLsn) {
-        pageLsns.set(i, pageLsn);
-    }
+	public void setPageLsn(int i, int pageLsn) {
+		pageLsns.set(i, pageLsn);
+	}
 
-    public void moveFirst() {
-        pageIds.moveFirst();
-        pageLsns.moveFirst();
-        pageIndexes.moveFirst();
-    }
+	public void moveFirst() {
+		pageIds.moveFirst();
+		pageLsns.moveFirst();
+		pageIndexes.moveFirst();
+	}
 
-    public void moveLast() {
-        pageIds.removeLast();
-        pageLsns.removeLast();
-        pageIndexes.removeLast();
-    }
+	public void moveLast() {
+		pageIds.removeLast();
+		pageLsns.removeLast();
+		pageIndexes.removeLast();
+	}
 
-    public boolean isLast() {
-        return pageIds.isLast();
-    }
+	public boolean isLast() {
+		return pageIds.isLast();
+	}
 
-    public void clear() {
-        pageIds.clear();
-        pageLsns.clear();
-        pageIndexes.clear();
-    }
+	public void clear() {
+		pageIds.clear();
+		pageLsns.clear();
+		pageIndexes.clear();
+	}
 
-    public boolean isEmpty() {
-        return pageIds.isEmpty();
-    }
+	public boolean isEmpty() {
+		return pageIds.isEmpty();
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java
index 8976409..03b2062 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java
@@ -47,891 +47,972 @@
 
 public class RTree implements ITreeIndex {
 
-    private boolean created = false;
-    private boolean loaded = false;
-    private final int rootPage = 1; // the root page never changes
+	private boolean created = false;
+	private boolean loaded = false;
+	private final int rootPage = 1; // the root page never changes
 
-    private final AtomicInteger globalNsn; // Global node sequence number
-    private int numOfPages = 1;
-    private final ReadWriteLock treeLatch;
+	private final AtomicInteger globalNsn; // Global node sequence number
+	private int numOfPages = 1;
+	private final ReadWriteLock treeLatch;
 
-    private final IFreePageManager freePageManager;
-    private final IBufferCache bufferCache;
-    private int fileId;
+	private final IFreePageManager freePageManager;
+	private final IBufferCache bufferCache;
+	private int fileId;
 
-    private final SearchPredicate diskOrderScanPredicate;
-    private final ITreeIndexFrameFactory interiorFrameFactory;
-    private final ITreeIndexFrameFactory leafFrameFactory;
-    private final MultiComparator cmp;
+	private final SearchPredicate diskOrderScanPredicate;
+	private final ITreeIndexFrameFactory interiorFrameFactory;
+	private final ITreeIndexFrameFactory leafFrameFactory;
+	private final MultiComparator cmp;
 
-    public int rootSplits = 0;
-    public int[] splitsByLevel = new int[500];
-    public AtomicLong readLatchesAcquired = new AtomicLong();
-    public AtomicLong readLatchesReleased = new AtomicLong();
-    public AtomicLong writeLatchesAcquired = new AtomicLong();
-    public AtomicLong writeLatchesReleased = new AtomicLong();
-    public AtomicLong pins = new AtomicLong();
-    public AtomicLong unpins = new AtomicLong();
-    public byte currentLevel = 0;
+	public int rootSplits = 0;
+	public int[] splitsByLevel = new int[500];
+	public AtomicLong readLatchesAcquired = new AtomicLong();
+	public AtomicLong readLatchesReleased = new AtomicLong();
+	public AtomicLong writeLatchesAcquired = new AtomicLong();
+	public AtomicLong writeLatchesReleased = new AtomicLong();
+	public AtomicLong pins = new AtomicLong();
+	public AtomicLong unpins = new AtomicLong();
+	public byte currentLevel = 0;
 
-    public RTree(IBufferCache bufferCache, IFreePageManager freePageManager,
-            ITreeIndexFrameFactory interiorFrameFactory, ITreeIndexFrameFactory leafFrameFactory, MultiComparator cmp) {
-        this.bufferCache = bufferCache;
-        this.freePageManager = freePageManager;
-        this.interiorFrameFactory = interiorFrameFactory;
-        this.leafFrameFactory = leafFrameFactory;
-        this.cmp = cmp;
-        globalNsn = new AtomicInteger();
-        this.treeLatch = new ReentrantReadWriteLock(true);
-        this.diskOrderScanPredicate = new SearchPredicate(null, cmp);
-    }
+	public RTree(IBufferCache bufferCache, IFreePageManager freePageManager,
+			ITreeIndexFrameFactory interiorFrameFactory,
+			ITreeIndexFrameFactory leafFrameFactory, MultiComparator cmp) {
+		this.bufferCache = bufferCache;
+		this.freePageManager = freePageManager;
+		this.interiorFrameFactory = interiorFrameFactory;
+		this.leafFrameFactory = leafFrameFactory;
+		this.cmp = cmp;
+		globalNsn = new AtomicInteger();
+		this.treeLatch = new ReentrantReadWriteLock(true);
+		this.diskOrderScanPredicate = new SearchPredicate(null, cmp);
+	}
 
-    public void incrementGlobalNsn() {
-        globalNsn.incrementAndGet();
-    }
+	public void incrementGlobalNsn() {
+		globalNsn.incrementAndGet();
+	}
 
-    public int getGlobalNsn() {
-        return globalNsn.get();
-    }
+	public int getGlobalNsn() {
+		return globalNsn.get();
+	}
 
-    public void incrementReadLatchesAcquired() {
-        readLatchesAcquired.incrementAndGet();
-    }
+	public void incrementReadLatchesAcquired() {
+		readLatchesAcquired.incrementAndGet();
+	}
 
-    public void incrementReadLatchesReleased() {
-        readLatchesReleased.incrementAndGet();
-    }
+	public void incrementReadLatchesReleased() {
+		readLatchesReleased.incrementAndGet();
+	}
 
-    public void incrementWriteLatchesAcquired() {
-        writeLatchesAcquired.incrementAndGet();
-    }
+	public void incrementWriteLatchesAcquired() {
+		writeLatchesAcquired.incrementAndGet();
+	}
 
-    public void incrementWriteLatchesReleased() {
-        writeLatchesReleased.incrementAndGet();
-    }
+	public void incrementWriteLatchesReleased() {
+		writeLatchesReleased.incrementAndGet();
+	}
 
-    public void incrementPins() {
-        pins.incrementAndGet();
-    }
+	public void incrementPins() {
+		pins.incrementAndGet();
+	}
 
-    public void incrementUnpins() {
-        unpins.incrementAndGet();
-    }
+	public void incrementUnpins() {
+		unpins.incrementAndGet();
+	}
 
-    public String printStats() {
-        StringBuilder strBuilder = new StringBuilder();
-        strBuilder.append("\n");
-        strBuilder.append("ROOTSPLITS: " + rootSplits + "\n");
-        strBuilder.append("SPLITS BY LEVEL\n");
-        for (int i = 0; i < currentLevel; i++) {
-            strBuilder.append(String.format("%3d ", i) + String.format("%8d ", splitsByLevel[i]) + "\n");
-        }
-        strBuilder.append(String.format("READ LATCHES:  %10d %10d\n", readLatchesAcquired.get(),
-                readLatchesReleased.get()));
-        strBuilder.append(String.format("WRITE LATCHES: %10d %10d\n", writeLatchesAcquired.get(),
-                writeLatchesReleased.get()));
-        strBuilder.append(String.format("PINS:          %10d %10d\n", pins.get(), unpins.get()));
+	public String printStats() {
+		StringBuilder strBuilder = new StringBuilder();
+		strBuilder.append("\n");
+		strBuilder.append("ROOTSPLITS: " + rootSplits + "\n");
+		strBuilder.append("SPLITS BY LEVEL\n");
+		for (int i = 0; i < currentLevel; i++) {
+			strBuilder.append(String.format("%3d ", i)
+					+ String.format("%8d ", splitsByLevel[i]) + "\n");
+		}
+		strBuilder.append(String.format("READ LATCHES:  %10d %10d\n",
+				readLatchesAcquired.get(), readLatchesReleased.get()));
+		strBuilder.append(String.format("WRITE LATCHES: %10d %10d\n",
+				writeLatchesAcquired.get(), writeLatchesReleased.get()));
+		strBuilder.append(String.format("PINS:          %10d %10d\n",
+				pins.get(), unpins.get()));
 
-        strBuilder.append(String.format("Num of Pages:          %10d\n", numOfPages));
+		strBuilder.append(String.format("Num of Pages:          %10d\n",
+				numOfPages));
 
-        return strBuilder.toString();
-    }
+		return strBuilder.toString();
+	}
 
-    public void printTree(IRTreeFrame leafFrame, IRTreeFrame interiorFrame, ISerializerDeserializer[] fields)
-            throws Exception {
-        printTree(rootPage, null, false, leafFrame, interiorFrame, fields);
-    }
+	public void printTree(IRTreeFrame leafFrame, IRTreeFrame interiorFrame,
+			ISerializerDeserializer[] fields) throws Exception {
+		printTree(rootPage, null, false, leafFrame, interiorFrame, fields);
+	}
 
-    public void printTree(int pageId, ICachedPage parent, boolean unpin, IRTreeFrame leafFrame,
-            IRTreeFrame interiorFrame, ISerializerDeserializer[] fields) throws Exception {
+	public void printTree(int pageId, ICachedPage parent, boolean unpin,
+			IRTreeFrame leafFrame, IRTreeFrame interiorFrame,
+			ISerializerDeserializer[] fields) throws Exception {
 
-        ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-        incrementPins();
-        node.acquireReadLatch();
-        incrementReadLatchesAcquired();
+		ICachedPage node = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, pageId), false);
+		incrementPins();
+		node.acquireReadLatch();
+		incrementReadLatchesAcquired();
 
-        try {
-            if (parent != null && unpin == true) {
-                parent.releaseReadLatch();
-                incrementReadLatchesReleased();
-                bufferCache.unpin(parent);
-                incrementUnpins();
-            }
+		try {
+			if (parent != null && unpin == true) {
+				parent.releaseReadLatch();
+				incrementReadLatchesReleased();
+				bufferCache.unpin(parent);
+				incrementUnpins();
+			}
 
-            interiorFrame.setPage(node);
-            int level = interiorFrame.getLevel();
+			interiorFrame.setPage(node);
+			int level = interiorFrame.getLevel();
 
-            System.out.format("%1d ", level);
-            System.out.format("%3d ", pageId);
-            for (int i = 0; i < currentLevel - level; i++)
-                System.out.format("    ");
+			System.out.format("%1d ", level);
+			System.out.format("%3d ", pageId);
+			for (int i = 0; i < currentLevel - level; i++)
+				System.out.format("    ");
 
-            String keyString;
-            if (interiorFrame.isLeaf()) {
-                leafFrame.setPage(node);
-                keyString = leafFrame.printKeys(cmp, fields);
-            } else {
-                keyString = interiorFrame.printKeys(cmp, fields);
-            }
+			String keyString;
+			if (interiorFrame.isLeaf()) {
+				leafFrame.setPage(node);
+				keyString = leafFrame.printKeys(cmp, fields);
+			} else {
+				keyString = interiorFrame.printKeys(cmp, fields);
+			}
 
-            System.out.format(keyString);
-            if (!interiorFrame.isLeaf()) {
-                ArrayList<Integer> children = ((RTreeNSMFrame) (interiorFrame)).getChildren(cmp);
-                for (int i = 0; i < children.size(); i++) {
-                    printTree(children.get(i), node, i == children.size() - 1, leafFrame, interiorFrame, fields);
-                }
-            } else {
-                node.releaseReadLatch();
-                incrementReadLatchesReleased();
-                bufferCache.unpin(node);
-                incrementUnpins();
-            }
-        } catch (Exception e) {
-            node.releaseReadLatch();
-            incrementReadLatchesReleased();
-            bufferCache.unpin(node);
-            incrementUnpins();
-            throw e;
-        }
-    }
+			System.out.format(keyString);
+			if (!interiorFrame.isLeaf()) {
+				ArrayList<Integer> children = ((RTreeNSMFrame) (interiorFrame))
+						.getChildren(cmp);
+				for (int i = 0; i < children.size(); i++) {
+					printTree(children.get(i), node, i == children.size() - 1,
+							leafFrame, interiorFrame, fields);
+				}
+			} else {
+				node.releaseReadLatch();
+				incrementReadLatchesReleased();
+				bufferCache.unpin(node);
+				incrementUnpins();
+			}
+		} catch (Exception e) {
+			node.releaseReadLatch();
+			incrementReadLatchesReleased();
+			bufferCache.unpin(node);
+			incrementUnpins();
+			throw e;
+		}
+	}
 
-    @Override
-    public void create(int fileId, ITreeIndexFrame leafFrame, ITreeIndexMetaDataFrame metaFrame) throws Exception {
-        if (created)
-            return;
+	@Override
+	public void create(int fileId, ITreeIndexFrame leafFrame,
+			ITreeIndexMetaDataFrame metaFrame) throws Exception {
+		if (created)
+			return;
 
-        treeLatch.writeLock().lock();
-        try {
-            // check if another thread beat us to it
-            if (created)
-                return;
+		treeLatch.writeLock().lock();
+		try {
+			// check if another thread beat us to it
+			if (created)
+				return;
 
-            freePageManager.init(metaFrame, rootPage);
+			freePageManager.init(metaFrame, rootPage);
 
-            // initialize root page
-            ICachedPage rootNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, rootPage), true);
-            incrementPins();
+			// initialize root page
+			ICachedPage rootNode = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, rootPage), true);
+			incrementPins();
 
-            rootNode.acquireWriteLatch();
-            incrementWriteLatchesAcquired();
-            try {
-                leafFrame.setPage(rootNode);
-                leafFrame.initBuffer((byte) 0);
-            } finally {
-                rootNode.releaseWriteLatch();
-                incrementWriteLatchesReleased();
-                bufferCache.unpin(rootNode);
-                incrementUnpins();
-            }
-            currentLevel = 0;
+			rootNode.acquireWriteLatch();
+			incrementWriteLatchesAcquired();
+			try {
+				leafFrame.setPage(rootNode);
+				leafFrame.initBuffer((byte) 0);
+			} finally {
+				rootNode.releaseWriteLatch();
+				incrementWriteLatchesReleased();
+				bufferCache.unpin(rootNode);
+				incrementUnpins();
+			}
+			currentLevel = 0;
 
-            created = true;
-        } finally {
-            treeLatch.writeLock().unlock();
-        }
-    }
+			created = true;
+		} finally {
+			treeLatch.writeLock().unlock();
+		}
+	}
 
-    public void open(int fileId) {
-        this.fileId = fileId;
-    }
+	public void open(int fileId) {
+		this.fileId = fileId;
+	}
 
-    public void close() {
-        fileId = -1;
-    }
+	public void close() {
+		fileId = -1;
+	}
 
-    @Override
-    public RTreeOpContext createOpContext(IndexOp op, ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
-            ITreeIndexMetaDataFrame metaFrame) {
-        return new RTreeOpContext(op, (IRTreeLeafFrame) leafFrame, (IRTreeInteriorFrame) interiorFrame, metaFrame, 8);
-    }
+	@Override
+	public RTreeOpContext createOpContext(IndexOp op,
+			ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
+			ITreeIndexMetaDataFrame metaFrame) {
+		return new RTreeOpContext(op, (IRTreeLeafFrame) leafFrame,
+				(IRTreeInteriorFrame) interiorFrame, metaFrame, 8);
+	}
 
-    @Override
-    public void insert(ITupleReference tuple, IndexOpContext ictx) throws Exception {
-        RTreeOpContext ctx = (RTreeOpContext) ictx;
-        ctx.reset();
-        ctx.setTuple(tuple);
-        ctx.splitKey.reset();
-        ctx.splitKey.getLeftTuple().setFieldCount(cmp.getKeyFieldCount());
-        ctx.splitKey.getRightTuple().setFieldCount(cmp.getKeyFieldCount());
-        ctx.interiorFrame.setPageTupleFieldCount(cmp.getKeyFieldCount());
-        ctx.leafFrame.setPageTupleFieldCount(cmp.getFieldCount());
+	@Override
+	public void insert(ITupleReference tuple, IndexOpContext ictx)
+			throws Exception {
+		RTreeOpContext ctx = (RTreeOpContext) ictx;
+		ctx.reset();
+		ctx.setTuple(tuple);
+		ctx.splitKey.reset();
+		ctx.splitKey.getLeftTuple().setFieldCount(cmp.getKeyFieldCount());
+		ctx.splitKey.getRightTuple().setFieldCount(cmp.getKeyFieldCount());
+		ctx.interiorFrame.setPageTupleFieldCount(cmp.getKeyFieldCount());
+		ctx.leafFrame.setPageTupleFieldCount(cmp.getFieldCount());
 
-        ICachedPage leafNode = findLeaf(ctx);
+		int maxFieldPos = cmp.getKeyFieldCount() / 2;
+		for (int i = 0; i < maxFieldPos; i++) {
+			int j = maxFieldPos + i;
+			int c = cmp.getComparators()[i].compare(tuple.getFieldData(i),
+					tuple.getFieldStart(i), tuple.getFieldLength(i),
+					tuple.getFieldData(j), tuple.getFieldStart(j),
+					tuple.getFieldLength(j));
+			if (c > 0) {
+				throw new IllegalArgumentException(
+						"The low key point has larger coordinates than the high key point.");
+			}
+		}
 
-        int pageId = ctx.pathList.getLastPageId();
-        ctx.pathList.moveLast();
-        insertTuple(leafNode, pageId, ctx.getTuple(), ctx, true);
+		ICachedPage leafNode = findLeaf(ctx);
 
-        while (true) {
-            if (ctx.splitKey.getLeftPageBuffer() != null) {
-                updateParentForInsert(ctx);
-            } else {
-                break;
-            }
-        }
+		int pageId = ctx.pathList.getLastPageId();
+		ctx.pathList.moveLast();
+		insertTuple(leafNode, pageId, ctx.getTuple(), ctx, true);
 
-        leafNode.releaseWriteLatch();
-        incrementWriteLatchesReleased();
-        bufferCache.unpin(leafNode);
-        incrementUnpins();
-    }
+		while (true) {
+			if (ctx.splitKey.getLeftPageBuffer() != null) {
+				updateParentForInsert(ctx);
+			} else {
+				break;
+			}
+		}
 
-    public ICachedPage findLeaf(RTreeOpContext ctx) throws Exception {
-        int pageId = rootPage;
-        boolean writeLatched = false;
-        ICachedPage node = null;
-        boolean isLeaf = false;
-        int pageLsn = 0, parentLsn = 0;
+		leafNode.releaseWriteLatch();
+		incrementWriteLatchesReleased();
+		bufferCache.unpin(leafNode);
+		incrementUnpins();
+	}
 
-        while (true) {
-            if (!writeLatched) {
-                node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-                incrementPins();
-                ctx.interiorFrame.setPage(node);
-                isLeaf = ctx.interiorFrame.isLeaf();
-                if (isLeaf) {
-                    node.acquireWriteLatch();
-                    incrementWriteLatchesAcquired();
-                    writeLatched = true;
+	public ICachedPage findLeaf(RTreeOpContext ctx) throws Exception {
+		int pageId = rootPage;
+		boolean writeLatched = false;
+		ICachedPage node = null;
+		boolean isLeaf = false;
+		int pageLsn = 0, parentLsn = 0;
 
-                    if (!ctx.interiorFrame.isLeaf()) {
-                        node.releaseWriteLatch();
-                        incrementWriteLatchesReleased();
-                        bufferCache.unpin(node);
-                        incrementUnpins();
-                        writeLatched = false;
-                        continue;
-                    }
-                } else {
-                    // Be optimistic and grab read latch first. We will swap it
-                    // to write latch if we need to enlarge the best child
-                    // tuple.
-                    node.acquireReadLatch();
-                    incrementReadLatchesAcquired();
-                }
-            }
+		while (true) {
+			if (!writeLatched) {
+				node = bufferCache
+						.pin(BufferedFileHandle.getDiskPageId(fileId, pageId),
+								false);
+				incrementPins();
+				ctx.interiorFrame.setPage(node);
+				isLeaf = ctx.interiorFrame.isLeaf();
+				if (isLeaf) {
+					node.acquireWriteLatch();
+					incrementWriteLatchesAcquired();
+					writeLatched = true;
 
-            if (pageId != rootPage && parentLsn < ctx.interiorFrame.getPageNsn()) {
-                // Concurrent split detected, go back to parent and re-choose
-                // the best child
-                if (writeLatched) {
-                    node.releaseWriteLatch();
-                    incrementWriteLatchesReleased();
-                    bufferCache.unpin(node);
-                    incrementUnpins();
-                    writeLatched = false;
-                } else {
-                    node.releaseReadLatch();
-                    incrementReadLatchesReleased();
-                    bufferCache.unpin(node);
-                    incrementUnpins();
-                }
+					if (!ctx.interiorFrame.isLeaf()) {
+						node.releaseWriteLatch();
+						incrementWriteLatchesReleased();
+						bufferCache.unpin(node);
+						incrementUnpins();
+						writeLatched = false;
+						continue;
+					}
+				} else {
+					// Be optimistic and grab read latch first. We will swap it
+					// to write latch if we need to enlarge the best child
+					// tuple.
+					node.acquireReadLatch();
+					incrementReadLatchesAcquired();
+				}
+			}
 
-                pageId = ctx.pathList.getLastPageId();
-                if (pageId != rootPage) {
-                    parentLsn = ctx.pathList.getPageLsn(ctx.pathList.size() - 2);
-                }
-                ctx.pathList.moveLast();
-                continue;
-            }
+			if (pageId != rootPage
+					&& parentLsn < ctx.interiorFrame.getPageNsn()) {
+				// Concurrent split detected, go back to parent and re-choose
+				// the best child
+				if (writeLatched) {
+					node.releaseWriteLatch();
+					incrementWriteLatchesReleased();
+					bufferCache.unpin(node);
+					incrementUnpins();
+					writeLatched = false;
+				} else {
+					node.releaseReadLatch();
+					incrementReadLatchesReleased();
+					bufferCache.unpin(node);
+					incrementUnpins();
+				}
 
-            pageLsn = ctx.interiorFrame.getPageLsn();
-            ctx.pathList.add(pageId, pageLsn, -1);
+				pageId = ctx.pathList.getLastPageId();
+				if (pageId != rootPage) {
+					parentLsn = ctx.pathList
+							.getPageLsn(ctx.pathList.size() - 2);
+				}
+				ctx.pathList.moveLast();
+				continue;
+			}
 
-            if (!isLeaf) {
-                // findBestChild must be called *before* getBestChildPageId
-                ctx.interiorFrame.findBestChild(ctx.getTuple(), cmp);
-                int childPageId = ctx.interiorFrame.getBestChildPageId(cmp);
+			pageLsn = ctx.interiorFrame.getPageLsn();
+			ctx.pathList.add(pageId, pageLsn, -1);
 
-                if (!writeLatched) {
-                    node.releaseReadLatch();
-                    incrementReadLatchesReleased();
-                    // TODO: do we need to un-pin and pin again?
-                    bufferCache.unpin(node);
-                    incrementUnpins();
+			if (!isLeaf) {
+				// findBestChild must be called *before* getBestChildPageId
+				ctx.interiorFrame.findBestChild(ctx.getTuple(), cmp);
+				int childPageId = ctx.interiorFrame.getBestChildPageId(cmp);
 
-                    node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-                    incrementPins();
-                    node.acquireWriteLatch();
-                    incrementWriteLatchesAcquired();
-                    ctx.interiorFrame.setPage(node);
-                    writeLatched = true;
+				if (!writeLatched) {
+					node.releaseReadLatch();
+					incrementReadLatchesReleased();
+					// TODO: do we need to un-pin and pin again?
+					bufferCache.unpin(node);
+					incrementUnpins();
 
-                    if (ctx.interiorFrame.getPageLsn() != pageLsn) {
-                        // The page was changed while we unlocked it; thus,
-                        // retry (re-choose best child)
+					node = bufferCache.pin(
+							BufferedFileHandle.getDiskPageId(fileId, pageId),
+							false);
+					incrementPins();
+					node.acquireWriteLatch();
+					incrementWriteLatchesAcquired();
+					ctx.interiorFrame.setPage(node);
+					writeLatched = true;
 
-                        ctx.pathList.moveLast();
-                        continue;
-                    }
-                }
+					if (ctx.interiorFrame.getPageLsn() != pageLsn) {
+						// The page was changed while we unlocked it; thus,
+						// retry (re-choose best child)
 
-                // We don't need to reset the frameTuple because it is
-                // already pointing to the best child
-                ctx.interiorFrame.enlarge(ctx.getTuple(), cmp);
+						ctx.pathList.moveLast();
+						continue;
+					}
+				}
 
-                node.releaseWriteLatch();
-                incrementWriteLatchesReleased();
-                bufferCache.unpin(node);
-                incrementUnpins();
-                writeLatched = false;
+				// We don't need to reset the frameTuple because it is
+				// already pointing to the best child
+				ctx.interiorFrame.enlarge(ctx.getTuple(), cmp);
 
-                pageId = childPageId;
-                parentLsn = pageLsn;
-            } else {
-                ctx.leafFrame.setPage(node);
-                return node;
-            }
-        }
-    }
+				node.releaseWriteLatch();
+				incrementWriteLatchesReleased();
+				bufferCache.unpin(node);
+				incrementUnpins();
+				writeLatched = false;
 
-    private void insertTuple(ICachedPage node, int pageId, ITupleReference tuple, RTreeOpContext ctx, boolean isLeaf)
-            throws Exception {
-        FrameOpSpaceStatus spaceStatus;
-        if (!isLeaf) {
-            spaceStatus = ctx.interiorFrame.hasSpaceInsert(tuple, cmp);
-        } else {
-            spaceStatus = ctx.leafFrame.hasSpaceInsert(tuple, cmp);
-        }
+				pageId = childPageId;
+				parentLsn = pageLsn;
+			} else {
+				ctx.leafFrame.setPage(node);
+				return node;
+			}
+		}
+	}
 
-        switch (spaceStatus) {
-            case SUFFICIENT_CONTIGUOUS_SPACE: {
-                if (!isLeaf) {
-                    ctx.interiorFrame.insert(tuple, cmp, -1);
-                    incrementGlobalNsn();
-                    ctx.interiorFrame.setPageLsn(getGlobalNsn());
-                } else {
-                    ctx.leafFrame.insert(tuple, cmp, -1);
-                    incrementGlobalNsn();
-                    ctx.leafFrame.setPageLsn(getGlobalNsn());
-                }
-                ctx.splitKey.reset();
-                break;
-            }
+	private void insertTuple(ICachedPage node, int pageId,
+			ITupleReference tuple, RTreeOpContext ctx, boolean isLeaf)
+			throws Exception {
+		FrameOpSpaceStatus spaceStatus;
+		if (!isLeaf) {
+			spaceStatus = ctx.interiorFrame.hasSpaceInsert(tuple, cmp);
+		} else {
+			spaceStatus = ctx.leafFrame.hasSpaceInsert(tuple, cmp);
+		}
 
-            case SUFFICIENT_SPACE: {
-                if (!isLeaf) {
-                    ctx.interiorFrame.compact(cmp);
-                    ctx.interiorFrame.insert(tuple, cmp, -1);
-                    incrementGlobalNsn();
-                    ctx.interiorFrame.setPageLsn(getGlobalNsn());
-                } else {
-                    ctx.leafFrame.compact(cmp);
-                    ctx.leafFrame.insert(tuple, cmp, -1);
-                    incrementGlobalNsn();
-                    ctx.leafFrame.setPageLsn(getGlobalNsn());
-                }
-                ctx.splitKey.reset();
-                break;
-            }
+		switch (spaceStatus) {
+		case SUFFICIENT_CONTIGUOUS_SPACE: {
+			if (!isLeaf) {
+				ctx.interiorFrame.insert(tuple, cmp, -1);
+				incrementGlobalNsn();
+				ctx.interiorFrame.setPageLsn(getGlobalNsn());
+			} else {
+				ctx.leafFrame.insert(tuple, cmp, -1);
+				incrementGlobalNsn();
+				ctx.leafFrame.setPageLsn(getGlobalNsn());
+			}
+			ctx.splitKey.reset();
+			break;
+		}
 
-            case INSUFFICIENT_SPACE: {
-                int rightPageId = freePageManager.getFreePage(ctx.metaFrame);
-                ICachedPage rightNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, rightPageId), true);
-                incrementPins();
-                rightNode.acquireWriteLatch();
-                incrementWriteLatchesAcquired();
+		case SUFFICIENT_SPACE: {
+			if (!isLeaf) {
+				ctx.interiorFrame.compact(cmp);
+				ctx.interiorFrame.insert(tuple, cmp, -1);
+				incrementGlobalNsn();
+				ctx.interiorFrame.setPageLsn(getGlobalNsn());
+			} else {
+				ctx.leafFrame.compact(cmp);
+				ctx.leafFrame.insert(tuple, cmp, -1);
+				incrementGlobalNsn();
+				ctx.leafFrame.setPageLsn(getGlobalNsn());
+			}
+			ctx.splitKey.reset();
+			break;
+		}
 
-                try {
-                    IRTreeFrame rightFrame;
-                    int ret;
-                    numOfPages++; // debug
-                    if (!isLeaf) {
-                        splitsByLevel[ctx.interiorFrame.getLevel()]++; // debug
-                        rightFrame = (IRTreeFrame) interiorFrameFactory.createFrame();
-                        rightFrame.setPage(rightNode);
-                        rightFrame.initBuffer((byte) ctx.interiorFrame.getLevel());
-                        rightFrame.setPageTupleFieldCount(cmp.getKeyFieldCount());
-                        ret = ctx.interiorFrame.split(rightFrame, tuple, cmp, ctx.splitKey);
-                        ctx.interiorFrame.setRightPage(rightPageId);
-                        rightFrame.setPageNsn(ctx.interiorFrame.getPageNsn());
-                        incrementGlobalNsn();
-                        int newNsn = getGlobalNsn();
-                        rightFrame.setPageLsn(newNsn);
-                        ctx.interiorFrame.setPageNsn(newNsn);
-                        ctx.interiorFrame.setPageLsn(newNsn);
-                    } else {
-                        splitsByLevel[0]++; // debug
-                        rightFrame = (IRTreeFrame) leafFrameFactory.createFrame();
-                        rightFrame.setPage(rightNode);
-                        rightFrame.initBuffer((byte) 0);
-                        rightFrame.setPageTupleFieldCount(cmp.getFieldCount());
-                        ret = ctx.leafFrame.split(rightFrame, tuple, cmp, ctx.splitKey);
-                        ctx.leafFrame.setRightPage(rightPageId);
-                        rightFrame.setPageNsn(ctx.leafFrame.getPageNsn());
-                        incrementGlobalNsn();
-                        int newNsn = getGlobalNsn();
-                        rightFrame.setPageLsn(newNsn);
-                        ctx.leafFrame.setPageNsn(newNsn);
-                        ctx.leafFrame.setPageLsn(newNsn);
-                    }
-                    if (ret != 0) {
-                        ctx.splitKey.reset();
-                    } else {
-                        ctx.splitKey.setPages(pageId, rightPageId);
-                    }
-                    if (pageId == rootPage) {
-                        rootSplits++; // debug
-                        splitsByLevel[currentLevel]++;
-                        currentLevel++;
+		case INSUFFICIENT_SPACE: {
+			int rightPageId = freePageManager.getFreePage(ctx.metaFrame);
+			ICachedPage rightNode = bufferCache
+					.pin(BufferedFileHandle.getDiskPageId(fileId, rightPageId),
+							true);
+			incrementPins();
+			rightNode.acquireWriteLatch();
+			incrementWriteLatchesAcquired();
 
-                        int newLeftId = freePageManager.getFreePage(ctx.metaFrame);
-                        ICachedPage newLeftNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, newLeftId),
-                                true);
-                        incrementPins();
-                        newLeftNode.acquireWriteLatch();
-                        incrementWriteLatchesAcquired();
-                        try {
-                            // copy left child to new left child
-                            System.arraycopy(node.getBuffer().array(), 0, newLeftNode.getBuffer().array(), 0,
-                                    newLeftNode.getBuffer().capacity());
+			try {
+				IRTreeFrame rightFrame;
+				int ret;
+				numOfPages++; // debug
+				if (!isLeaf) {
+					splitsByLevel[ctx.interiorFrame.getLevel()]++; // debug
+					rightFrame = (IRTreeFrame) interiorFrameFactory
+							.createFrame();
+					rightFrame.setPage(rightNode);
+					rightFrame.initBuffer((byte) ctx.interiorFrame.getLevel());
+					rightFrame.setPageTupleFieldCount(cmp.getKeyFieldCount());
+					ret = ctx.interiorFrame.split(rightFrame, tuple, cmp,
+							ctx.splitKey);
+					ctx.interiorFrame.setRightPage(rightPageId);
+					rightFrame.setPageNsn(ctx.interiorFrame.getPageNsn());
+					incrementGlobalNsn();
+					int newNsn = getGlobalNsn();
+					rightFrame.setPageLsn(newNsn);
+					ctx.interiorFrame.setPageNsn(newNsn);
+					ctx.interiorFrame.setPageLsn(newNsn);
+				} else {
+					splitsByLevel[0]++; // debug
+					rightFrame = (IRTreeFrame) leafFrameFactory.createFrame();
+					rightFrame.setPage(rightNode);
+					rightFrame.initBuffer((byte) 0);
+					rightFrame.setPageTupleFieldCount(cmp.getFieldCount());
+					ret = ctx.leafFrame.split(rightFrame, tuple, cmp,
+							ctx.splitKey);
+					ctx.leafFrame.setRightPage(rightPageId);
+					rightFrame.setPageNsn(ctx.leafFrame.getPageNsn());
+					incrementGlobalNsn();
+					int newNsn = getGlobalNsn();
+					rightFrame.setPageLsn(newNsn);
+					ctx.leafFrame.setPageNsn(newNsn);
+					ctx.leafFrame.setPageLsn(newNsn);
+				}
+				if (ret != 0) {
+					ctx.splitKey.reset();
+				} else {
+					ctx.splitKey.setPages(pageId, rightPageId);
+				}
+				if (pageId == rootPage) {
+					rootSplits++; // debug
+					splitsByLevel[currentLevel]++;
+					currentLevel++;
 
-                            // initialize new root (leftNode becomes new root)
-                            ctx.interiorFrame.setPage(node);
-                            ctx.interiorFrame.initBuffer((byte) (ctx.interiorFrame.getLevel() + 1));
+					int newLeftId = freePageManager.getFreePage(ctx.metaFrame);
+					ICachedPage newLeftNode = bufferCache
+							.pin(BufferedFileHandle.getDiskPageId(fileId,
+									newLeftId), true);
+					incrementPins();
+					newLeftNode.acquireWriteLatch();
+					incrementWriteLatchesAcquired();
+					try {
+						// copy left child to new left child
+						System.arraycopy(node.getBuffer().array(), 0,
+								newLeftNode.getBuffer().array(), 0, newLeftNode
+										.getBuffer().capacity());
+
+						// initialize new root (leftNode becomes new root)
+						ctx.interiorFrame.setPage(node);
+						ctx.interiorFrame.initBuffer((byte) (ctx.interiorFrame
+								.getLevel() + 1));
 
-                            ctx.splitKey.setLeftPage(newLeftId);
+						ctx.splitKey.setLeftPage(newLeftId);
 
-                            ctx.interiorFrame.insert(ctx.splitKey.getLeftTuple(), cmp, -1);
-                            ctx.interiorFrame.insert(ctx.splitKey.getRightTuple(), cmp, -1);
+						ctx.interiorFrame.insert(ctx.splitKey.getLeftTuple(),
+								cmp, -1);
+						ctx.interiorFrame.insert(ctx.splitKey.getRightTuple(),
+								cmp, -1);
 
-                            incrementGlobalNsn();
-                            int newNsn = getGlobalNsn();
-                            ctx.interiorFrame.setPageLsn(newNsn);
-                            ctx.interiorFrame.setPageNsn(newNsn);
-                        } finally {
-                            newLeftNode.releaseWriteLatch();
-                            incrementWriteLatchesReleased();
-                            bufferCache.unpin(newLeftNode);
-                            incrementUnpins();
-                        }
+						incrementGlobalNsn();
+						int newNsn = getGlobalNsn();
+						ctx.interiorFrame.setPageLsn(newNsn);
+						ctx.interiorFrame.setPageNsn(newNsn);
+					} finally {
+						newLeftNode.releaseWriteLatch();
+						incrementWriteLatchesReleased();
+						bufferCache.unpin(newLeftNode);
+						incrementUnpins();
+					}
 
-                        ctx.splitKey.reset();
-                    }
-                } finally {
-                    rightNode.releaseWriteLatch();
-                    incrementWriteLatchesReleased();
-                    bufferCache.unpin(rightNode);
-                    incrementUnpins();
-                }
-                break;
-            }
-        }
-    }
+					ctx.splitKey.reset();
+				}
+			} finally {
+				rightNode.releaseWriteLatch();
+				incrementWriteLatchesReleased();
+				bufferCache.unpin(rightNode);
+				incrementUnpins();
+			}
+			break;
+		}
+		}
+	}
 
-    public void updateParentForInsert(RTreeOpContext ctx) throws Exception {
-        int parentId = ctx.pathList.getLastPageId();
-        ICachedPage parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
-        incrementPins();
-        parentNode.acquireWriteLatch();
-        incrementWriteLatchesAcquired();
-        ctx.interiorFrame.setPage(parentNode);
-        boolean foundParent = true;
+	public void updateParentForInsert(RTreeOpContext ctx) throws Exception {
+		int parentId = ctx.pathList.getLastPageId();
+		ICachedPage parentNode = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, parentId), false);
+		incrementPins();
+		parentNode.acquireWriteLatch();
+		incrementWriteLatchesAcquired();
+		ctx.interiorFrame.setPage(parentNode);
+		boolean foundParent = true;
 
-        if (ctx.interiorFrame.getPageLsn() != ctx.pathList.getLastPageLsn()) {
-            foundParent = false;
-            while (true) {
-                if (ctx.interiorFrame.findTupleByPointer(ctx.splitKey.getLeftTuple(), cmp) != -1) {
-                    // found the parent
-                    foundParent = true;
-                    break;
-                }
-                int rightPage = ctx.interiorFrame.getRightPage();
-                parentNode.releaseWriteLatch();
-                incrementWriteLatchesReleased();
-                bufferCache.unpin(parentNode);
-                incrementUnpins();
+		if (ctx.interiorFrame.getPageLsn() != ctx.pathList.getLastPageLsn()) {
+			foundParent = false;
+			while (true) {
+				if (ctx.interiorFrame.findTupleByPointer(
+						ctx.splitKey.getLeftTuple(), cmp) != -1) {
+					// found the parent
+					foundParent = true;
+					break;
+				}
+				int rightPage = ctx.interiorFrame.getRightPage();
+				parentNode.releaseWriteLatch();
+				incrementWriteLatchesReleased();
+				bufferCache.unpin(parentNode);
+				incrementUnpins();
 
-                if (rightPage == -1) {
-                    break;
-                }
+				if (rightPage == -1) {
+					break;
+				}
 
-                parentId = rightPage;
-                parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
-                incrementPins();
-                parentNode.acquireWriteLatch();
-                incrementWriteLatchesAcquired();
-                ctx.interiorFrame.setPage(parentNode);
-            }
-        }
-        if (foundParent) {
-            ctx.interiorFrame.adjustKey(ctx.splitKey.getLeftTuple(), -1, cmp);
-            insertTuple(parentNode, parentId, ctx.splitKey.getRightTuple(), ctx, ctx.interiorFrame.isLeaf());
-            ctx.pathList.moveLast();
+				parentId = rightPage;
+				parentNode = bufferCache.pin(
+						BufferedFileHandle.getDiskPageId(fileId, parentId),
+						false);
+				incrementPins();
+				parentNode.acquireWriteLatch();
+				incrementWriteLatchesAcquired();
+				ctx.interiorFrame.setPage(parentNode);
+			}
+		}
+		if (foundParent) {
+			ctx.interiorFrame.adjustKey(ctx.splitKey.getLeftTuple(), -1, cmp);
+			insertTuple(parentNode, parentId, ctx.splitKey.getRightTuple(),
+					ctx, ctx.interiorFrame.isLeaf());
+			ctx.pathList.moveLast();
 
-            parentNode.releaseWriteLatch();
-            incrementWriteLatchesReleased();
-            bufferCache.unpin(parentNode);
-            incrementUnpins();
-            return;
-        }
+			parentNode.releaseWriteLatch();
+			incrementWriteLatchesReleased();
+			bufferCache.unpin(parentNode);
+			incrementUnpins();
+			return;
+		}
 
-        // very rare situation when the there is a root split, do an exhaustive
-        // breadth-first traversal looking for the parent tuple
+		// very rare situation when the there is a root split, do an exhaustive
+		// breadth-first traversal looking for the parent tuple
 
-        ctx.pathList.clear();
-        ctx.traverseList.clear();
-        findPath(ctx);
-        updateParentForInsert(ctx);
-    }
+		ctx.pathList.clear();
+		ctx.traverseList.clear();
+		findPath(ctx);
+		updateParentForInsert(ctx);
+	}
 
-    public void findPath(RTreeOpContext ctx) throws Exception {
-        int pageId = rootPage;
-        int parentIndex = -1;
-        int parentLsn = 0;
-        int pageLsn, pageIndex;
-        ctx.traverseList.add(pageId, -1, parentIndex);
-        while (!ctx.traverseList.isLast()) {
-            pageId = ctx.traverseList.getFirstPageId();
-            parentIndex = ctx.traverseList.getFirstPageIndex();
+	public void findPath(RTreeOpContext ctx) throws Exception {
+		int pageId = rootPage;
+		int parentIndex = -1;
+		int parentLsn = 0;
+		int pageLsn, pageIndex;
+		ctx.traverseList.add(pageId, -1, parentIndex);
+		while (!ctx.traverseList.isLast()) {
+			pageId = ctx.traverseList.getFirstPageId();
+			parentIndex = ctx.traverseList.getFirstPageIndex();
 
-            ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-            incrementPins();
-            node.acquireReadLatch();
-            incrementReadLatchesAcquired();
-            ctx.interiorFrame.setPage(node);
-            pageLsn = ctx.interiorFrame.getPageLsn();
-            pageIndex = ctx.traverseList.first();
-            ctx.traverseList.setPageLsn(pageIndex, pageLsn);
+			ICachedPage node = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, pageId), false);
+			incrementPins();
+			node.acquireReadLatch();
+			incrementReadLatchesAcquired();
+			ctx.interiorFrame.setPage(node);
+			pageLsn = ctx.interiorFrame.getPageLsn();
+			pageIndex = ctx.traverseList.first();
+			ctx.traverseList.setPageLsn(pageIndex, pageLsn);
 
-            ctx.traverseList.moveFirst();
+			ctx.traverseList.moveFirst();
 
-            if (pageId != rootPage && parentLsn < ctx.interiorFrame.getPageNsn()) {
-                int rightPage = ctx.interiorFrame.getRightPage();
-                if (rightPage != -1) {
-                    ctx.traverseList.add(rightPage, -1, parentIndex);
-                }
-            }
-            parentLsn = pageLsn;
+			if (pageId != rootPage
+					&& parentLsn < ctx.interiorFrame.getPageNsn()) {
+				int rightPage = ctx.interiorFrame.getRightPage();
+				if (rightPage != -1) {
+					ctx.traverseList.add(rightPage, -1, parentIndex);
+				}
+			}
+			parentLsn = pageLsn;
 
-            if (ctx.interiorFrame.findTupleByPointer(ctx.splitKey.getLeftTuple(), ctx.traverseList, pageIndex, cmp) != -1) {
-                fillPath(ctx, pageIndex);
+			if (ctx.interiorFrame.findTupleByPointer(
+					ctx.splitKey.getLeftTuple(), ctx.traverseList, pageIndex,
+					cmp) != -1) {
+				fillPath(ctx, pageIndex);
 
-                node.releaseReadLatch();
-                incrementReadLatchesReleased();
-                bufferCache.unpin(node);
-                incrementUnpins();
-                return;
-            }
-            node.releaseReadLatch();
-            incrementReadLatchesReleased();
-            bufferCache.unpin(node);
-            incrementUnpins();
-        }
-    }
+				node.releaseReadLatch();
+				incrementReadLatchesReleased();
+				bufferCache.unpin(node);
+				incrementUnpins();
+				return;
+			}
+			node.releaseReadLatch();
+			incrementReadLatchesReleased();
+			bufferCache.unpin(node);
+			incrementUnpins();
+		}
+	}
 
-    public void fillPath(RTreeOpContext ctx, int pageIndex) throws Exception {
-        if (pageIndex != -1) {
-            fillPath(ctx, ctx.traverseList.getPageIndex(pageIndex));
-            ctx.pathList.add(ctx.traverseList.getPageId(pageIndex), ctx.traverseList.getPageLsn(pageIndex), -1);
-        }
-    }
+	public void fillPath(RTreeOpContext ctx, int pageIndex) throws Exception {
+		if (pageIndex != -1) {
+			fillPath(ctx, ctx.traverseList.getPageIndex(pageIndex));
+			ctx.pathList.add(ctx.traverseList.getPageId(pageIndex),
+					ctx.traverseList.getPageLsn(pageIndex), -1);
+		}
+	}
 
-    @Override
-    public void delete(ITupleReference tuple, IndexOpContext ictx) throws Exception {
-        RTreeOpContext ctx = (RTreeOpContext) ictx;
-        ctx.reset();
-        ctx.setTuple(tuple);
-        ctx.splitKey.reset();
-        ctx.splitKey.getLeftTuple().setFieldCount(cmp.getKeyFieldCount());
-        ctx.interiorFrame.setPageTupleFieldCount(cmp.getKeyFieldCount());
-        ctx.leafFrame.setPageTupleFieldCount(cmp.getFieldCount());
+	@Override
+	public void delete(ITupleReference tuple, IndexOpContext ictx)
+			throws Exception {
+		RTreeOpContext ctx = (RTreeOpContext) ictx;
+		ctx.reset();
+		ctx.setTuple(tuple);
+		ctx.splitKey.reset();
+		ctx.splitKey.getLeftTuple().setFieldCount(cmp.getKeyFieldCount());
+		ctx.interiorFrame.setPageTupleFieldCount(cmp.getKeyFieldCount());
+		ctx.leafFrame.setPageTupleFieldCount(cmp.getFieldCount());
 
-        int tupleIndex = findTupleToDelete(ctx);
+		int tupleIndex = findTupleToDelete(ctx);
 
-        if (tupleIndex != -1) {
-            int pageId = ctx.pathList.getLastPageId();
-            ctx.pathList.moveLast();
-            deleteTuple(pageId, tupleIndex, ctx);
+		if (tupleIndex != -1) {
+			int pageId = ctx.pathList.getLastPageId();
+			ctx.pathList.moveLast();
+			deleteTuple(pageId, tupleIndex, ctx);
 
-            while (true) {
-                if (ctx.splitKey.getLeftPageBuffer() != null) {
-                    updateParentForDelete(ctx);
-                } else {
-                    break;
-                }
-            }
+			while (true) {
+				if (ctx.splitKey.getLeftPageBuffer() != null) {
+					updateParentForDelete(ctx);
+				} else {
+					break;
+				}
+			}
 
-            ctx.leafFrame.getPage().releaseWriteLatch();
-            incrementWriteLatchesReleased();
-            bufferCache.unpin(ctx.leafFrame.getPage());
-            incrementUnpins();
-        }
-    }
+			ctx.leafFrame.getPage().releaseWriteLatch();
+			incrementWriteLatchesReleased();
+			bufferCache.unpin(ctx.leafFrame.getPage());
+			incrementUnpins();
+		}
+	}
 
-    public void updateParentForDelete(RTreeOpContext ctx) throws Exception {
-        int parentId = ctx.pathList.getLastPageId();
-        ICachedPage parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
-        incrementPins();
-        parentNode.acquireWriteLatch();
-        incrementWriteLatchesAcquired();
-        ctx.interiorFrame.setPage(parentNode);
-        boolean foundParent = true;
-        int tupleIndex = -1;
+	public void updateParentForDelete(RTreeOpContext ctx) throws Exception {
+		int parentId = ctx.pathList.getLastPageId();
+		ICachedPage parentNode = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, parentId), false);
+		incrementPins();
+		parentNode.acquireWriteLatch();
+		incrementWriteLatchesAcquired();
+		ctx.interiorFrame.setPage(parentNode);
+		boolean foundParent = true;
+		int tupleIndex = -1;
 
-        if (ctx.interiorFrame.getPageLsn() != ctx.pathList.getLastPageLsn()) {
-            foundParent = false;
-            while (true) {
-                tupleIndex = ctx.interiorFrame.findTupleByPointer(ctx.splitKey.getLeftTuple(), cmp);
-                if (tupleIndex != -1) {
-                    // found the parent
-                    foundParent = true;
-                    break;
-                }
-                int rightPage = ctx.interiorFrame.getRightPage();
-                parentNode.releaseWriteLatch();
-                incrementWriteLatchesReleased();
-                bufferCache.unpin(parentNode);
-                incrementUnpins();
+		if (ctx.interiorFrame.getPageLsn() != ctx.pathList.getLastPageLsn()) {
+			foundParent = false;
+			while (true) {
+				tupleIndex = ctx.interiorFrame.findTupleByPointer(
+						ctx.splitKey.getLeftTuple(), cmp);
+				if (tupleIndex != -1) {
+					// found the parent
+					foundParent = true;
+					break;
+				}
+				int rightPage = ctx.interiorFrame.getRightPage();
+				parentNode.releaseWriteLatch();
+				incrementWriteLatchesReleased();
+				bufferCache.unpin(parentNode);
+				incrementUnpins();
 
-                if (rightPage == -1) {
-                    break;
-                }
+				if (rightPage == -1) {
+					break;
+				}
 
-                parentId = rightPage;
-                parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
-                incrementPins();
-                parentNode.acquireWriteLatch();
-                incrementWriteLatchesAcquired();
-                ctx.interiorFrame.setPage(parentNode);
-            }
-        }
-        if (foundParent) {
-            if (tupleIndex == -1) {
-                tupleIndex = ctx.interiorFrame.findTupleByPointer(ctx.splitKey.getLeftTuple(), cmp);
-            }
-            boolean recomputeMBR = ctx.interiorFrame.recomputeMBR(ctx.splitKey.getLeftTuple(), tupleIndex, cmp);
+				parentId = rightPage;
+				parentNode = bufferCache.pin(
+						BufferedFileHandle.getDiskPageId(fileId, parentId),
+						false);
+				incrementPins();
+				parentNode.acquireWriteLatch();
+				incrementWriteLatchesAcquired();
+				ctx.interiorFrame.setPage(parentNode);
+			}
+		}
+		if (foundParent) {
+			if (tupleIndex == -1) {
+				tupleIndex = ctx.interiorFrame.findTupleByPointer(
+						ctx.splitKey.getLeftTuple(), cmp);
+			}
+			boolean recomputeMBR = ctx.interiorFrame.recomputeMBR(
+					ctx.splitKey.getLeftTuple(), tupleIndex, cmp);
 
-            if (recomputeMBR) {
-                ctx.interiorFrame.adjustKey(ctx.splitKey.getLeftTuple(), tupleIndex, cmp);
-                ctx.pathList.moveLast();
+			if (recomputeMBR) {
+				ctx.interiorFrame.adjustKey(ctx.splitKey.getLeftTuple(),
+						tupleIndex, cmp);
+				ctx.pathList.moveLast();
 
-                incrementGlobalNsn();
-                ctx.interiorFrame.setPageLsn(getGlobalNsn());
+				incrementGlobalNsn();
+				ctx.interiorFrame.setPageLsn(getGlobalNsn());
 
-                ctx.splitKey.reset();
-                if (!ctx.pathList.isEmpty()) {
-                    ctx.interiorFrame.computeMBR(ctx.splitKey, cmp);
-                    ctx.splitKey.setLeftPage(parentId);
-                }
-            } else {
-                ctx.pathList.moveLast();
-                ctx.splitKey.reset();
-            }
+				ctx.splitKey.reset();
+				if (!ctx.pathList.isEmpty()) {
+					ctx.interiorFrame.computeMBR(ctx.splitKey, cmp);
+					ctx.splitKey.setLeftPage(parentId);
+				}
+			} else {
+				ctx.pathList.moveLast();
+				ctx.splitKey.reset();
+			}
 
-            parentNode.releaseWriteLatch();
-            incrementWriteLatchesReleased();
-            bufferCache.unpin(parentNode);
-            incrementUnpins();
-            return;
-        }
+			parentNode.releaseWriteLatch();
+			incrementWriteLatchesReleased();
+			bufferCache.unpin(parentNode);
+			incrementUnpins();
+			return;
+		}
 
-        // very rare situation when the there is a root split, do an exhaustive
-        // breadth-first traversal looking for the parent tuple
+		// very rare situation when the there is a root split, do an exhaustive
+		// breadth-first traversal looking for the parent tuple
 
-        ctx.pathList.clear();
-        ctx.traverseList.clear();
-        findPath(ctx);
-        updateParentForDelete(ctx);
-    }
+		ctx.pathList.clear();
+		ctx.traverseList.clear();
+		findPath(ctx);
+		updateParentForDelete(ctx);
+	}
 
-    public int findTupleToDelete(RTreeOpContext ctx) throws Exception {
+	public int findTupleToDelete(RTreeOpContext ctx) throws Exception {
 
-        ctx.traverseList.add(rootPage, -1, -1);
-        ctx.pathList.add(rootPage, -1, ctx.traverseList.size() - 1);
+		ctx.traverseList.add(rootPage, -1, -1);
+		ctx.pathList.add(rootPage, -1, ctx.traverseList.size() - 1);
 
-        while (!ctx.pathList.isEmpty()) {
-            int pageId = ctx.pathList.getLastPageId();
-            int parentLsn = ctx.pathList.getLastPageLsn();
-            int pageIndex = ctx.pathList.getLastPageIndex();
-            ctx.pathList.moveLast();
-            ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-            incrementPins();
-            node.acquireReadLatch();
-            incrementReadLatchesAcquired();
-            ctx.interiorFrame.setPage(node);
-            boolean isLeaf = ctx.interiorFrame.isLeaf();
-            int pageLsn = ctx.interiorFrame.getPageLsn();
-            int parentIndex = ctx.traverseList.getPageIndex(pageIndex);
-            ctx.traverseList.setPageLsn(pageIndex, pageLsn);
+		while (!ctx.pathList.isEmpty()) {
+			int pageId = ctx.pathList.getLastPageId();
+			int parentLsn = ctx.pathList.getLastPageLsn();
+			int pageIndex = ctx.pathList.getLastPageIndex();
+			ctx.pathList.moveLast();
+			ICachedPage node = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, pageId), false);
+			incrementPins();
+			node.acquireReadLatch();
+			incrementReadLatchesAcquired();
+			ctx.interiorFrame.setPage(node);
+			boolean isLeaf = ctx.interiorFrame.isLeaf();
+			int pageLsn = ctx.interiorFrame.getPageLsn();
+			int parentIndex = ctx.traverseList.getPageIndex(pageIndex);
+			ctx.traverseList.setPageLsn(pageIndex, pageLsn);
 
-            if (pageId != rootPage && parentLsn < ctx.interiorFrame.getPageNsn()) {
-                // Concurrent split detected, we need to visit the right page
-                int rightPage = ctx.interiorFrame.getRightPage();
-                if (rightPage != -1) {
-                    ctx.traverseList.add(rightPage, -1, parentIndex);
-                    ctx.pathList.add(rightPage, parentLsn, ctx.traverseList.size() - 1);
-                }
-            }
+			if (pageId != rootPage
+					&& parentLsn < ctx.interiorFrame.getPageNsn()) {
+				// Concurrent split detected, we need to visit the right page
+				int rightPage = ctx.interiorFrame.getRightPage();
+				if (rightPage != -1) {
+					ctx.traverseList.add(rightPage, -1, parentIndex);
+					ctx.pathList.add(rightPage, parentLsn,
+							ctx.traverseList.size() - 1);
+				}
+			}
 
-            if (!isLeaf) {
-                for (int i = 0; i < ctx.interiorFrame.getTupleCount(); i++) {
-                    int childPageId = ctx.interiorFrame.getChildPageIdIfIntersect(ctx.tuple, i, cmp);
-                    if (childPageId != -1) {
-                        ctx.traverseList.add(childPageId, -1, pageIndex);
-                        ctx.pathList.add(childPageId, pageLsn, ctx.traverseList.size() - 1);
-                    }
-                }
-            } else {
-                ctx.leafFrame.setPage(node);
-                int tupleIndex = ctx.leafFrame.findTupleIndex(ctx.tuple, cmp);
-                if (tupleIndex != -1) {
+			if (!isLeaf) {
+				for (int i = 0; i < ctx.interiorFrame.getTupleCount(); i++) {
+					int childPageId = ctx.interiorFrame
+							.getChildPageIdIfIntersect(ctx.tuple, i, cmp);
+					if (childPageId != -1) {
+						ctx.traverseList.add(childPageId, -1, pageIndex);
+						ctx.pathList.add(childPageId, pageLsn,
+								ctx.traverseList.size() - 1);
+					}
+				}
+			} else {
+				ctx.leafFrame.setPage(node);
+				int tupleIndex = ctx.leafFrame.findTupleIndex(ctx.tuple, cmp);
+				if (tupleIndex != -1) {
 
-                    node.releaseReadLatch();
-                    incrementReadLatchesReleased();
-                    bufferCache.unpin(node);
-                    incrementUnpins();
+					node.releaseReadLatch();
+					incrementReadLatchesReleased();
+					bufferCache.unpin(node);
+					incrementUnpins();
 
-                    node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-                    incrementPins();
-                    node.acquireWriteLatch();
-                    incrementWriteLatchesAcquired();
-                    ctx.leafFrame.setPage(node);
+					node = bufferCache.pin(
+							BufferedFileHandle.getDiskPageId(fileId, pageId),
+							false);
+					incrementPins();
+					node.acquireWriteLatch();
+					incrementWriteLatchesAcquired();
+					ctx.leafFrame.setPage(node);
 
-                    if (ctx.leafFrame.getPageLsn() != pageLsn) {
-                        // The page was changed while we unlocked it
+					if (ctx.leafFrame.getPageLsn() != pageLsn) {
+						// The page was changed while we unlocked it
 
-                        tupleIndex = ctx.leafFrame.findTupleIndex(ctx.tuple, cmp);
-                        if (tupleIndex == -1) {
-                            ctx.traverseList.add(pageId, -1, parentIndex);
-                            ctx.pathList.add(pageId, parentLsn, ctx.traverseList.size() - 1);
+						tupleIndex = ctx.leafFrame.findTupleIndex(ctx.tuple,
+								cmp);
+						if (tupleIndex == -1) {
+							ctx.traverseList.add(pageId, -1, parentIndex);
+							ctx.pathList.add(pageId, parentLsn,
+									ctx.traverseList.size() - 1);
 
-                            node.releaseWriteLatch();
-                            incrementWriteLatchesReleased();
-                            bufferCache.unpin(node);
-                            incrementUnpins();
-                            continue;
-                        } else {
-                            ctx.pathList.clear();
-                            fillPath(ctx, pageIndex);
-                            return tupleIndex;
-                        }
-                    } else {
-                        ctx.pathList.clear();
-                        fillPath(ctx, pageIndex);
-                        return tupleIndex;
-                    }
-                }
-            }
-            node.releaseReadLatch();
-            incrementReadLatchesReleased();
-            bufferCache.unpin(node);
-            incrementUnpins();
-        }
-        return -1;
-    }
+							node.releaseWriteLatch();
+							incrementWriteLatchesReleased();
+							bufferCache.unpin(node);
+							incrementUnpins();
+							continue;
+						} else {
+							ctx.pathList.clear();
+							fillPath(ctx, pageIndex);
+							return tupleIndex;
+						}
+					} else {
+						ctx.pathList.clear();
+						fillPath(ctx, pageIndex);
+						return tupleIndex;
+					}
+				}
+			}
+			node.releaseReadLatch();
+			incrementReadLatchesReleased();
+			bufferCache.unpin(node);
+			incrementUnpins();
+		}
+		return -1;
+	}
 
-    public void deleteTuple(int pageId, int tupleIndex, RTreeOpContext ctx) throws Exception {
-        ctx.leafFrame.delete(tupleIndex, cmp);
-        incrementGlobalNsn();
-        ctx.leafFrame.setPageLsn(getGlobalNsn());
+	public void deleteTuple(int pageId, int tupleIndex, RTreeOpContext ctx)
+			throws Exception {
+		ctx.leafFrame.delete(tupleIndex, cmp);
+		incrementGlobalNsn();
+		ctx.leafFrame.setPageLsn(getGlobalNsn());
 
-        // if the page is empty, just leave it there for future inserts
-        if (pageId != rootPage && ctx.leafFrame.getTupleCount() > 0) {
-            ctx.leafFrame.computeMBR(ctx.splitKey, cmp);
-            ctx.splitKey.setLeftPage(pageId);
-        }
-    }
+		// if the page is empty, just leave it there for future inserts
+		if (pageId != rootPage && ctx.leafFrame.getTupleCount() > 0) {
+			ctx.leafFrame.computeMBR(ctx.splitKey, cmp);
+			ctx.splitKey.setLeftPage(pageId);
+		}
+	}
 
-    public void search(ITreeIndexCursor cursor, SearchPredicate pred, RTreeOpContext ctx) throws Exception {
-        ctx.reset();
-        ctx.cursor = cursor;
+	public void search(ITreeIndexCursor cursor, SearchPredicate pred,
+			RTreeOpContext ctx) throws Exception {
+		ctx.reset();
+		ctx.cursor = cursor;
 
-        cursor.setBufferCache(bufferCache);
-        cursor.setFileId(fileId);
-        ctx.cursorInitialState.setRootPage(rootPage);
-        ctx.cursor.open(ctx.cursorInitialState, pred);
-    }
+		cursor.setBufferCache(bufferCache);
+		cursor.setFileId(fileId);
+		ctx.cursorInitialState.setRootPage(rootPage);
+		ctx.cursor.open(ctx.cursorInitialState, pred);
+	}
 
-    public ITreeIndexFrameFactory getInteriorFrameFactory() {
-        return interiorFrameFactory;
-    }
+	public ITreeIndexFrameFactory getInteriorFrameFactory() {
+		return interiorFrameFactory;
+	}
 
-    public ITreeIndexFrameFactory getLeafFrameFactory() {
-        return leafFrameFactory;
-    }
+	public ITreeIndexFrameFactory getLeafFrameFactory() {
+		return leafFrameFactory;
+	}
 
-    public MultiComparator getCmp() {
-        return cmp;
-    }
+	public MultiComparator getCmp() {
+		return cmp;
+	}
 
-    public IFreePageManager getFreePageManager() {
-        return freePageManager;
-    }
+	public IFreePageManager getFreePageManager() {
+		return freePageManager;
+	}
 
-    @Override
-    public void update(ITupleReference tuple, IndexOpContext ictx) throws Exception {
-        throw new Exception("RTree Update not implemented.");
-    }
+	@Override
+	public void update(ITupleReference tuple, IndexOpContext ictx)
+			throws Exception {
+		throw new Exception("RTree Update not implemented.");
+	}
 
-    public final class BulkLoadContext implements IIndexBulkLoadContext {
+	public final class BulkLoadContext implements IIndexBulkLoadContext {
 
-        public RTreeOpContext insertOpCtx;
+		public RTreeOpContext insertOpCtx;
 
-        public BulkLoadContext(float fillFactor, IRTreeFrame leafFrame, IRTreeFrame interiorFrame,
-                ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
+		public BulkLoadContext(float fillFactor, IRTreeFrame leafFrame,
+				IRTreeFrame interiorFrame, ITreeIndexMetaDataFrame metaFrame)
+				throws HyracksDataException {
 
-            insertOpCtx = createOpContext(IndexOp.INSERT, leafFrame, interiorFrame, metaFrame);
-        }
-    }
+			insertOpCtx = createOpContext(IndexOp.INSERT, leafFrame,
+					interiorFrame, metaFrame);
+		}
+	}
 
-    @Override
-    public IIndexBulkLoadContext beginBulkLoad(float fillFactor, ITreeIndexFrame leafFrame,
-            ITreeIndexFrame interiorFrame, ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
-        if (loaded)
-            throw new HyracksDataException("Trying to bulk-load RTree but has RTree already been loaded.");
+	@Override
+	public IIndexBulkLoadContext beginBulkLoad(float fillFactor,
+			ITreeIndexFrame leafFrame, ITreeIndexFrame interiorFrame,
+			ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
+		if (loaded)
+			throw new HyracksDataException(
+					"Trying to bulk-load RTree but RTree has already been loaded.");
 
-        BulkLoadContext ctx = new BulkLoadContext(fillFactor, (IRTreeFrame) leafFrame, (IRTreeFrame) interiorFrame,
-                metaFrame);
-        return ctx;
-    }
+		BulkLoadContext ctx = new BulkLoadContext(fillFactor,
+				(IRTreeFrame) leafFrame, (IRTreeFrame) interiorFrame, metaFrame);
+		return ctx;
+	}
 
-    @Override
-    public void bulkLoadAddTuple(IIndexBulkLoadContext ictx, ITupleReference tuple) throws HyracksDataException {
-        try {
-            insert(tuple, ((BulkLoadContext) ictx).insertOpCtx);
-        } catch (Exception e) {
-            throw new HyracksDataException("BulkLoad Error");
-        }
-    }
+	@Override
+	public void bulkLoadAddTuple(IIndexBulkLoadContext ictx,
+			ITupleReference tuple) throws HyracksDataException {
+		try {
+			insert(tuple, ((BulkLoadContext) ictx).insertOpCtx);
+		} catch (Exception e) {
+			throw new HyracksDataException("BulkLoad Error");
+		}
+	}
 
-    @Override
-    public void endBulkLoad(IIndexBulkLoadContext ictx) throws HyracksDataException {
-        loaded = true;
-    }
+	@Override
+	public void endBulkLoad(IIndexBulkLoadContext ictx)
+			throws HyracksDataException {
+		loaded = true;
+	}
 
-    @Override
-    public void diskOrderScan(ITreeIndexCursor icursor, ITreeIndexFrame leafFrame, ITreeIndexMetaDataFrame metaFrame,
-            IndexOpContext ictx) throws HyracksDataException {
-        TreeDiskOrderScanCursor cursor = (TreeDiskOrderScanCursor) icursor;
-        RTreeOpContext ctx = (RTreeOpContext) ictx;
-        ctx.reset();
+	@Override
+	public void diskOrderScan(ITreeIndexCursor icursor,
+			ITreeIndexFrame leafFrame, ITreeIndexMetaDataFrame metaFrame,
+			IndexOpContext ictx) throws HyracksDataException {
+		TreeDiskOrderScanCursor cursor = (TreeDiskOrderScanCursor) icursor;
+		RTreeOpContext ctx = (RTreeOpContext) ictx;
+		ctx.reset();
 
-        int currentPageId = rootPage + 1;
-        int maxPageId = freePageManager.getMaxPage(metaFrame);
+		int currentPageId = rootPage + 1;
+		int maxPageId = freePageManager.getMaxPage(metaFrame);
 
-        ICachedPage page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, currentPageId), false);
-        page.acquireReadLatch();
-        cursor.setBufferCache(bufferCache);
-        cursor.setFileId(fileId);
-        cursor.setCurrentPageId(currentPageId);
-        cursor.setMaxPageId(maxPageId);
-        ctx.cursorInitialState.setPage(page);
-        cursor.open(ctx.cursorInitialState, diskOrderScanPredicate);
-    }
+		ICachedPage page = bufferCache.pin(
+				BufferedFileHandle.getDiskPageId(fileId, currentPageId), false);
+		page.acquireReadLatch();
+		cursor.setBufferCache(bufferCache);
+		cursor.setFileId(fileId);
+		cursor.setCurrentPageId(currentPageId);
+		cursor.setMaxPageId(maxPageId);
+		ctx.cursorInitialState.setPage(page);
+		cursor.open(ctx.cursorInitialState, diskOrderScanPredicate);
+	}
 
-    @Override
-    public int getRootPageId() {
-        return rootPage;
-    }
+	@Override
+	public int getRootPageId() {
+		return rootPage;
+	}
 
-    @Override
-    public int getFieldCount() {
-        return cmp.getFieldCount();
-    }
+	@Override
+	public int getFieldCount() {
+		return cmp.getFieldCount();
+	}
 
-    @Override
-    public IndexType getIndexType() {
-        return IndexType.RTREE;
-    }
-}
+	@Override
+	public IndexType getIndexType() {
+		return IndexType.RTREE;
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java
index 8b94a04..ac1eb7d 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java
@@ -20,32 +20,32 @@
 
 public class RTreeCursorInitialState implements ICursorInitialState {
 
-    private PathList pathList;
-    private int rootPage;
-    private ICachedPage page; // for disk order scan
+	private PathList pathList;
+	private int rootPage;
+	private ICachedPage page; // for disk order scan
 
-    public RTreeCursorInitialState(PathList pathList, int rootPage) {
-        this.pathList = pathList;
-        this.rootPage = rootPage;
-    }
+	public RTreeCursorInitialState(PathList pathList, int rootPage) {
+		this.pathList = pathList;
+		this.rootPage = rootPage;
+	}
 
-    public PathList getPathList() {
-        return pathList;
-    }
+	public PathList getPathList() {
+		return pathList;
+	}
 
-    public int getRootPage() {
-        return rootPage;
-    }
+	public int getRootPage() {
+		return rootPage;
+	}
 
-    public void setRootPage(int rootPage) {
-        this.rootPage = rootPage;
-    }
+	public void setRootPage(int rootPage) {
+		this.rootPage = rootPage;
+	}
 
-    public ICachedPage getPage() {
-        return page;
-    }
+	public ICachedPage getPage() {
+		return page;
+	}
 
-    public void setPage(ICachedPage page) {
-        this.page = page;
-    }
+	public void setPage(ICachedPage page) {
+		this.page = page;
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java
index ea8af28..fc57019 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java
@@ -24,51 +24,54 @@
 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeLeafFrame;
 
 public final class RTreeOpContext implements IndexOpContext {
-    public final IndexOp op;
-    public final IRTreeInteriorFrame interiorFrame;
-    public final IRTreeLeafFrame leafFrame;
-    public ITreeIndexCursor cursor;
-    public RTreeCursorInitialState cursorInitialState;
-    public final ITreeIndexMetaDataFrame metaFrame;
-    public final RTreeSplitKey splitKey;
-    public ITupleReference tuple;
-    public final PathList pathList; // used to record the pageIds and pageLsns
-                                    // of the visited pages
-    public final PathList traverseList; // used for traversing the tree
-    private static final int initTraverseListSize = 100;
+	public final IndexOp op;
+	public final IRTreeInteriorFrame interiorFrame;
+	public final IRTreeLeafFrame leafFrame;
+	public ITreeIndexCursor cursor;
+	public RTreeCursorInitialState cursorInitialState;
+	public final ITreeIndexMetaDataFrame metaFrame;
+	public final RTreeSplitKey splitKey;
+	public ITupleReference tuple;
+	public final PathList pathList; // used to record the pageIds and pageLsns
+									// of the visited pages
+	public final PathList traverseList; // used for traversing the tree
+	private static final int initTraverseListSize = 100;
 
-    public RTreeOpContext(IndexOp op, IRTreeLeafFrame leafFrame, IRTreeInteriorFrame interiorFrame,
-            ITreeIndexMetaDataFrame metaFrame, int treeHeightHint) {
-        this.op = op;
-        this.interiorFrame = interiorFrame;
-        this.leafFrame = leafFrame;
-        this.metaFrame = metaFrame;
-        pathList = new PathList(treeHeightHint, treeHeightHint);
-        if (op != IndexOp.SEARCH && op != IndexOp.DISKORDERSCAN) {
-            splitKey = new RTreeSplitKey(interiorFrame.getTupleWriter().createTupleReference(), interiorFrame
-                    .getTupleWriter().createTupleReference());
-            traverseList = new PathList(initTraverseListSize, initTraverseListSize);
-        } else {
-            splitKey = null;
-            traverseList = null;
-            cursorInitialState = new RTreeCursorInitialState(pathList, 1);
-        }
-    }
+	public RTreeOpContext(IndexOp op, IRTreeLeafFrame leafFrame,
+			IRTreeInteriorFrame interiorFrame,
+			ITreeIndexMetaDataFrame metaFrame, int treeHeightHint) {
+		this.op = op;
+		this.interiorFrame = interiorFrame;
+		this.leafFrame = leafFrame;
+		this.metaFrame = metaFrame;
+		pathList = new PathList(treeHeightHint, treeHeightHint);
+		if (op != IndexOp.SEARCH && op != IndexOp.DISKORDERSCAN) {
+			splitKey = new RTreeSplitKey(interiorFrame.getTupleWriter()
+					.createTupleReference(), interiorFrame.getTupleWriter()
+					.createTupleReference());
+			traverseList = new PathList(initTraverseListSize,
+					initTraverseListSize);
+		} else {
+			splitKey = null;
+			traverseList = null;
+			cursorInitialState = new RTreeCursorInitialState(pathList, 1);
+		}
+	}
 
-    public ITupleReference getTuple() {
-        return tuple;
-    }
+	public ITupleReference getTuple() {
+		return tuple;
+	}
 
-    public void setTuple(ITupleReference tuple) {
-        this.tuple = tuple;
-    }
+	public void setTuple(ITupleReference tuple) {
+		this.tuple = tuple;
+	}
 
-    public void reset() {
-        if (pathList != null) {
-            pathList.clear();
-        }
-        if (traverseList != null) {
-            traverseList.clear();
-        }
-    }
+	public void reset() {
+		if (pathList != null) {
+			pathList.clear();
+		}
+		if (traverseList != null) {
+			traverseList.clear();
+		}
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java
index 86a7bfd..9d37d86 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java
@@ -30,172 +30,189 @@
 
 public class RTreeSearchCursor implements ITreeIndexCursor {
 
-    private int fileId = -1;
-    private ICachedPage page = null;
-    private IRTreeInteriorFrame interiorFrame = null;
-    private IRTreeLeafFrame leafFrame = null;
-    private IBufferCache bufferCache = null;
+	private int fileId = -1;
+	private ICachedPage page = null;
+	private IRTreeInteriorFrame interiorFrame = null;
+	private IRTreeLeafFrame leafFrame = null;
+	private IBufferCache bufferCache = null;
 
-    private SearchPredicate pred;
-    private PathList pathList;
-    private int rootPage;
-    ITupleReference searchKey;
+	private SearchPredicate pred;
+	private PathList pathList;
+	private int rootPage;
+	ITupleReference searchKey;
 
-    private int tupleIndex = 0;
-    private int tupleIndexInc = 0;
+	private int tupleIndex = 0;
+	private int tupleIndexInc = 0;
 
-    private MultiComparator cmp;
+	private MultiComparator cmp;
 
-    private ITreeIndexTupleReference frameTuple;
-    private boolean readLatched = false;
+	private ITreeIndexTupleReference frameTuple;
+	private boolean readLatched = false;
 
-    private int pin = 0;
-    private int unpin = 0;
+	private int pin = 0;
+	private int unpin = 0;
 
-    public RTreeSearchCursor(IRTreeInteriorFrame interiorFrame, IRTreeLeafFrame leafFrame) {
-        this.interiorFrame = interiorFrame;
-        this.leafFrame = leafFrame;
-        this.frameTuple = leafFrame.createTupleReference();
-    }
+	public RTreeSearchCursor(IRTreeInteriorFrame interiorFrame,
+			IRTreeLeafFrame leafFrame) {
+		this.interiorFrame = interiorFrame;
+		this.leafFrame = leafFrame;
+		this.frameTuple = leafFrame.createTupleReference();
+	}
 
-    @Override
-    public void close() throws Exception {
-        if (readLatched) {
-            page.releaseReadLatch();
-            bufferCache.unpin(page);
-            readLatched = false;
-        }
-        tupleIndex = 0;
-        tupleIndexInc = 0;
-        page = null;
-        pathList = null;
-    }
+	@Override
+	public void close() throws Exception {
+		if (readLatched) {
+			page.releaseReadLatch();
+			bufferCache.unpin(page);
+			readLatched = false;
+		}
+		tupleIndex = 0;
+		tupleIndexInc = 0;
+		page = null;
+		pathList = null;
+	}
 
-    public ITupleReference getTuple() {
-        return frameTuple;
-    }
+	public ITupleReference getTuple() {
+		return frameTuple;
+	}
 
-    @Override
-    public ICachedPage getPage() {
-        return page;
-    }
+	@Override
+	public ICachedPage getPage() {
+		return page;
+	}
 
-    public boolean fetchNextLeafPage() throws HyracksDataException {
-        if (readLatched) {
-            page.releaseReadLatch();
-            bufferCache.unpin(page);
-            unpin++;
-            readLatched = false;
-        }
-        while (!pathList.isEmpty()) {
-            int pageId = pathList.getLastPageId();
-            int parentLsn = pathList.getLastPageLsn();
-            pathList.moveLast();
-            ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
-            pin++;
-            node.acquireReadLatch();
-            readLatched = true;
-            interiorFrame.setPage(node);
-            boolean isLeaf = interiorFrame.isLeaf();
-            int pageLsn = interiorFrame.getPageLsn();
+	public boolean fetchNextLeafPage() throws HyracksDataException {
+		if (readLatched) {
+			page.releaseReadLatch();
+			bufferCache.unpin(page);
+			unpin++;
+			readLatched = false;
+		}
+		while (!pathList.isEmpty()) {
+			int pageId = pathList.getLastPageId();
+			int parentLsn = pathList.getLastPageLsn();
+			pathList.moveLast();
+			ICachedPage node = bufferCache.pin(
+					BufferedFileHandle.getDiskPageId(fileId, pageId), false);
+			pin++;
+			node.acquireReadLatch();
+			readLatched = true;
+			interiorFrame.setPage(node);
+			boolean isLeaf = interiorFrame.isLeaf();
+			int pageLsn = interiorFrame.getPageLsn();
 
-            if (pageId != rootPage && parentLsn < interiorFrame.getPageNsn()) {
-                // Concurrent split detected, we need to visit the right page
-                int rightPage = interiorFrame.getRightPage();
-                if (rightPage != -1) {
-                    pathList.add(rightPage, parentLsn, -1);
-                }
-            }
+			if (pageId != rootPage && parentLsn < interiorFrame.getPageNsn()) {
+				// Concurrent split detected, we need to visit the right page
+				int rightPage = interiorFrame.getRightPage();
+				if (rightPage != -1) {
+					pathList.add(rightPage, parentLsn, -1);
+				}
+			}
 
-            if (!isLeaf) {
-                for (int i = 0; i < interiorFrame.getTupleCount(); i++) {
-                    int childPageId = interiorFrame.getChildPageIdIfIntersect(searchKey, i, cmp);
-                    if (childPageId != -1) {
-                        pathList.add(childPageId, pageLsn, -1);
-                    }
-                }
-            } else {
-                page = node;
-                leafFrame.setPage(page);
-                tupleIndex = 0;
-                return true;
-            }
-            node.releaseReadLatch();
-            readLatched = false;
-            bufferCache.unpin(node);
-            unpin++;
-        }
-        return false;
-    }
+			if (!isLeaf) {
+				for (int i = 0; i < interiorFrame.getTupleCount(); i++) {
+					int childPageId = interiorFrame.getChildPageIdIfIntersect(
+							searchKey, i, cmp);
+					if (childPageId != -1) {
+						pathList.add(childPageId, pageLsn, -1);
+					}
+				}
+			} else {
+				page = node;
+				leafFrame.setPage(page);
+				tupleIndex = 0;
+				return true;
+			}
+			node.releaseReadLatch();
+			readLatched = false;
+			bufferCache.unpin(node);
+			unpin++;
+		}
+		return false;
+	}
 
-    @Override
-    public boolean hasNext() throws Exception {
-        if (page == null) {
-            return false;
-        }
+	@Override
+	public boolean hasNext() throws Exception {
+		if (page == null) {
+			return false;
+		}
 
-        if (tupleIndex == leafFrame.getTupleCount()) {
-            if (!fetchNextLeafPage()) {
-                return false;
-            }
-        }
+		if (tupleIndex == leafFrame.getTupleCount()) {
+			if (!fetchNextLeafPage()) {
+				return false;
+			}
+		}
 
-        do {
-            for (int i = tupleIndex; i < leafFrame.getTupleCount(); i++) {
-                if (leafFrame.intersect(searchKey, i, cmp)) {
-                    frameTuple.resetByTupleIndex(leafFrame, i);
-                    tupleIndexInc = i + 1;
-                    return true;
-                }
-            }
-        } while (fetchNextLeafPage());
-        return false;
-    }
+		do {
+			for (int i = tupleIndex; i < leafFrame.getTupleCount(); i++) {
+				if (leafFrame.intersect(searchKey, i, cmp)) {
+					frameTuple.resetByTupleIndex(leafFrame, i);
+					tupleIndexInc = i + 1;
+					return true;
+				}
+			}
+		} while (fetchNextLeafPage());
+		return false;
+	}
 
-    @Override
-    public void next() throws Exception {
-        tupleIndex = tupleIndexInc;
-    }
+	@Override
+	public void next() throws Exception {
+		tupleIndex = tupleIndexInc;
+	}
 
-    @Override
-    public void open(ICursorInitialState initialState, ISearchPredicate searchPred) throws Exception {
-        // in case open is called multiple times without closing
-        if (this.page != null) {
-            this.page.releaseReadLatch();
-            readLatched = false;
-            bufferCache.unpin(this.page);
-            pathList.clear();
-        }
+	@Override
+	public void open(ICursorInitialState initialState,
+			ISearchPredicate searchPred) throws Exception {
+		// in case open is called multiple times without closing
+		if (this.page != null) {
+			this.page.releaseReadLatch();
+			readLatched = false;
+			bufferCache.unpin(this.page);
+			pathList.clear();
+		}
 
-        pathList = ((RTreeCursorInitialState) initialState).getPathList();
-        rootPage = ((RTreeCursorInitialState) initialState).getRootPage();
+		pathList = ((RTreeCursorInitialState) initialState).getPathList();
+		rootPage = ((RTreeCursorInitialState) initialState).getRootPage();
 
-        pred = (SearchPredicate) searchPred;
-        cmp = pred.getLowKeyComparator();
-        searchKey = pred.getSearchKey();
+		pred = (SearchPredicate) searchPred;
+		cmp = pred.getLowKeyComparator();
+		searchKey = pred.getSearchKey();
 
-        pathList.add(this.rootPage, -1, -1);
-        frameTuple.setFieldCount(cmp.getFieldCount());
-        tupleIndex = 0;
-        fetchNextLeafPage();
-    }
+		int maxFieldPos = cmp.getKeyFieldCount() / 2;
+		for (int i = 0; i < maxFieldPos; i++) {
+			int j = maxFieldPos + i;
+			int c = cmp.getComparators()[i].compare(searchKey.getFieldData(i),
+					searchKey.getFieldStart(i), searchKey.getFieldLength(i),
+					searchKey.getFieldData(j), searchKey.getFieldStart(j),
+					searchKey.getFieldLength(j));
+			if (c > 0) {
+				throw new IllegalArgumentException(
+						"The low key point has larger coordinates than the high key point.");
+			}
+		}
 
-    @Override
-    public void reset() {
-        try {
-            close();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
+		pathList.add(this.rootPage, -1, -1);
+		frameTuple.setFieldCount(cmp.getFieldCount());
+		tupleIndex = 0;
+		fetchNextLeafPage();
+	}
 
-    @Override
-    public void setBufferCache(IBufferCache bufferCache) {
-        this.bufferCache = bufferCache;
-    }
+	@Override
+	public void reset() {
+		try {
+			close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 
-    @Override
-    public void setFileId(int fileId) {
-        this.fileId = fileId;
-    }
-}
+	@Override
+	public void setBufferCache(IBufferCache bufferCache) {
+		this.bufferCache = bufferCache;
+	}
+
+	@Override
+	public void setFileId(int fileId) {
+		this.fileId = fileId;
+	}
+}
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSplitKey.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSplitKey.java
index f220ea3..ecbcd38 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSplitKey.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeSplitKey.java
@@ -21,132 +21,134 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleReference;
 
 public class RTreeSplitKey implements ISplitKey {
-    public byte[] leftPageData = null;
-    public ByteBuffer leftPageBuf = null;
-    public ITreeIndexTupleReference leftTuple;
+	public byte[] leftPageData = null;
+	public ByteBuffer leftPageBuf = null;
+	public ITreeIndexTupleReference leftTuple;
 
-    public byte[] rightPageData = null;
-    public ByteBuffer rightPageBuf = null;
-    public ITreeIndexTupleReference rightTuple;
+	public byte[] rightPageData = null;
+	public ByteBuffer rightPageBuf = null;
+	public ITreeIndexTupleReference rightTuple;
 
-    public int keySize = 0;
+	public int keySize = 0;
 
-    public RTreeSplitKey(ITreeIndexTupleReference leftTuple, ITreeIndexTupleReference rightTuple) {
-        this.leftTuple = leftTuple;
-        this.rightTuple = rightTuple;
-    }
+	public RTreeSplitKey(ITreeIndexTupleReference leftTuple,
+			ITreeIndexTupleReference rightTuple) {
+		this.leftTuple = leftTuple;
+		this.rightTuple = rightTuple;
+	}
 
-    public void initData(int keySize) {
-        // try to reuse existing memory from a lower-level split if possible
-        this.keySize = keySize;
-        if (leftPageData != null) {
-            if (leftPageData.length < keySize + 4) {
-                leftPageData = new byte[keySize + 4]; // add 4 for the page
-                leftPageBuf = ByteBuffer.wrap(leftPageData);
-            }
-        } else {
-            leftPageData = new byte[keySize + 4]; // add 4 for the page
-            leftPageBuf = ByteBuffer.wrap(leftPageData);
-        }
-        if (rightPageData != null) {
-            if (rightPageData.length < keySize + 4) {
-                rightPageData = new byte[keySize + 4]; // add 4 for the page
-                rightPageBuf = ByteBuffer.wrap(rightPageData);
-            }
-        } else {
-            rightPageData = new byte[keySize + 4]; // add 4 for the page
-            rightPageBuf = ByteBuffer.wrap(rightPageData);
-        }
+	public void initData(int keySize) {
+		// try to reuse existing memory from a lower-level split if possible
+		this.keySize = keySize;
+		if (leftPageData != null) {
+			if (leftPageData.length < keySize + 4) {
+				leftPageData = new byte[keySize + 4]; // add 4 for the page
+				leftPageBuf = ByteBuffer.wrap(leftPageData);
+			}
+		} else {
+			leftPageData = new byte[keySize + 4]; // add 4 for the page
+			leftPageBuf = ByteBuffer.wrap(leftPageData);
+		}
+		if (rightPageData != null) {
+			if (rightPageData.length < keySize + 4) {
+				rightPageData = new byte[keySize + 4]; // add 4 for the page
+				rightPageBuf = ByteBuffer.wrap(rightPageData);
+			}
+		} else {
+			rightPageData = new byte[keySize + 4]; // add 4 for the page
+			rightPageBuf = ByteBuffer.wrap(rightPageData);
+		}
 
-        leftTuple.resetByTupleOffset(leftPageBuf, 0);
-        rightTuple.resetByTupleOffset(rightPageBuf, 0);
-    }
+		leftTuple.resetByTupleOffset(leftPageBuf, 0);
+		rightTuple.resetByTupleOffset(rightPageBuf, 0);
+	}
 
-    public void resetLeftPage() {
-        leftPageData = null;
-        leftPageBuf = null;
-    }
+	public void resetLeftPage() {
+		leftPageData = null;
+		leftPageBuf = null;
+	}
 
-    public void resetRightPage() {
-        rightPageData = null;
-        rightPageBuf = null;
-    }
+	public void resetRightPage() {
+		rightPageData = null;
+		rightPageBuf = null;
+	}
 
-    public ByteBuffer getLeftPageBuffer() {
-        return leftPageBuf;
-    }
+	public ByteBuffer getLeftPageBuffer() {
+		return leftPageBuf;
+	}
 
-    public ByteBuffer getRightPageBuffer() {
-        return rightPageBuf;
-    }
+	public ByteBuffer getRightPageBuffer() {
+		return rightPageBuf;
+	}
 
-    public ITreeIndexTupleReference getLeftTuple() {
-        return leftTuple;
-    }
+	public ITreeIndexTupleReference getLeftTuple() {
+		return leftTuple;
+	}
 
-    public ITreeIndexTupleReference getRightTuple() {
-        return rightTuple;
-    }
+	public ITreeIndexTupleReference getRightTuple() {
+		return rightTuple;
+	}
 
-    public int getLeftPage() {
-        return leftPageBuf.getInt(keySize);
-    }
+	public int getLeftPage() {
+		return leftPageBuf.getInt(keySize);
+	}
 
-    public int getRightPage() {
-        return rightPageBuf.getInt(keySize);
-    }
+	public int getRightPage() {
+		return rightPageBuf.getInt(keySize);
+	}
 
-    public void setLeftPage(int page) {
-        leftPageBuf.putInt(keySize, page);
-    }
+	public void setLeftPage(int page) {
+		leftPageBuf.putInt(keySize, page);
+	}
 
-    public void setRightPage(int page) {
-        rightPageBuf.putInt(keySize, page);
-    }
+	public void setRightPage(int page) {
+		rightPageBuf.putInt(keySize, page);
+	}
 
-    public ISplitKey duplicate(ITreeIndexTupleReference copyLeftTuple, ITreeIndexTupleReference copyRightTuple) {
-        RTreeSplitKey copy = new RTreeSplitKey(copyLeftTuple, copyRightTuple);
-        copy.leftPageData = leftPageData.clone();
-        copy.leftPageBuf = ByteBuffer.wrap(copy.leftPageData);
-        copy.leftTuple.setFieldCount(leftTuple.getFieldCount());
-        copy.leftTuple.resetByTupleOffset(copy.leftPageBuf, 0);
+	public ISplitKey duplicate(ITreeIndexTupleReference copyLeftTuple,
+			ITreeIndexTupleReference copyRightTuple) {
+		RTreeSplitKey copy = new RTreeSplitKey(copyLeftTuple, copyRightTuple);
+		copy.leftPageData = leftPageData.clone();
+		copy.leftPageBuf = ByteBuffer.wrap(copy.leftPageData);
+		copy.leftTuple.setFieldCount(leftTuple.getFieldCount());
+		copy.leftTuple.resetByTupleOffset(copy.leftPageBuf, 0);
 
-        copy.rightPageData = rightPageData.clone();
-        copy.rightPageBuf = ByteBuffer.wrap(copy.rightPageData);
-        copy.rightTuple.setFieldCount(rightTuple.getFieldCount());
-        copy.rightTuple.resetByTupleOffset(copy.rightPageBuf, 0);
-        return copy;
-    }
+		copy.rightPageData = rightPageData.clone();
+		copy.rightPageBuf = ByteBuffer.wrap(copy.rightPageData);
+		copy.rightTuple.setFieldCount(rightTuple.getFieldCount());
+		copy.rightTuple.resetByTupleOffset(copy.rightPageBuf, 0);
+		return copy;
+	}
 
-    @Override
-    public void reset() {
-        leftPageData = null;
-        leftPageBuf = null;
-        rightPageData = null;
-        rightPageBuf = null;
-    }
+	@Override
+	public void reset() {
+		leftPageData = null;
+		leftPageBuf = null;
+		rightPageData = null;
+		rightPageBuf = null;
+	}
 
-    @Override
-    public ByteBuffer getBuffer() {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	@Override
+	public ByteBuffer getBuffer() {
+		// TODO Auto-generated method stub
+		return null;
+	}
 
-    @Override
-    public ITreeIndexTupleReference getTuple() {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	@Override
+	public ITreeIndexTupleReference getTuple() {
+		// TODO Auto-generated method stub
+		return null;
+	}
 
-    @Override
-    public void setPages(int leftPage, int rightPage) {
-        leftPageBuf.putInt(keySize, leftPage);
-        rightPageBuf.putInt(keySize, rightPage);
-    }
+	@Override
+	public void setPages(int leftPage, int rightPage) {
+		leftPageBuf.putInt(keySize, leftPage);
+		rightPageBuf.putInt(keySize, rightPage);
+	}
 
-    @Override
-    public ISplitKey duplicate(ITreeIndexTupleReference copyTuple) {
-        // TODO Auto-generated method stub
-        return null;
-    }
+	@Override
+	public ISplitKey duplicate(ITreeIndexTupleReference copyTuple) {
+		// TODO Auto-generated method stub
+		return null;
+	}
 }
\ No newline at end of file
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/Rectangle.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/Rectangle.java
index ef78a9b..019760b 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/Rectangle.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/Rectangle.java
@@ -16,20 +16,17 @@
 package edu.uci.ics.hyracks.storage.am.rtree.impls;
 
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
-import edu.uci.ics.hyracks.storage.am.rtree.api.IGenericPrimitiveSerializerDeserializer;
+import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
 
 public class Rectangle {
 	private int dim;
 	private double[] low;
 	private double[] high;
-	private IGenericPrimitiveSerializerDeserializer[] recDescSers;
 
-	public Rectangle(int dim,
-			IGenericPrimitiveSerializerDeserializer[] recDescSers) {
+	public Rectangle(int dim) {
 		this.dim = dim;
 		low = new double[this.dim];
 		high = new double[this.dim];
-		this.recDescSers = recDescSers;
 	}
 
 	public int getDim() {
@@ -52,28 +49,26 @@
 		high[i] = value;
 	}
 
-	public void set(ITupleReference tuple) {
+	public void set(ITupleReference tuple, MultiComparator cmp) {
 		for (int i = 0; i < getDim(); i++) {
 			int j = i + getDim();
-			setLow(i,
-					recDescSers[i].getValue(tuple.getFieldData(i),
-							tuple.getFieldStart(i)));
-			setHigh(i,
-					recDescSers[j].getValue(tuple.getFieldData(j),
-							tuple.getFieldStart(j)));
+			setLow(i, cmp.getValueProviders()[i].getValue(
+					tuple.getFieldData(i), tuple.getFieldStart(i)));
+			setHigh(i, cmp.getValueProviders()[j].getValue(
+					tuple.getFieldData(j), tuple.getFieldStart(j)));
 		}
 	}
 
-	public void enlarge(ITupleReference tupleToBeInserted) {
+	public void enlarge(ITupleReference tupleToBeInserted, MultiComparator cmp) {
 		for (int i = 0; i < getDim(); i++) {
 			int j = getDim() + i;
-			double low = recDescSers[i].getValue(
+			double low = cmp.getValueProviders()[i].getValue(
 					tupleToBeInserted.getFieldData(i),
 					tupleToBeInserted.getFieldStart(i));
 			if (getLow(i) > low) {
 				setLow(i, low);
 			}
-			double high = recDescSers[j].getValue(
+			double high = cmp.getValueProviders()[j].getValue(
 					tupleToBeInserted.getFieldData(j),
 					tupleToBeInserted.getFieldStart(j));
 			if (getHigh(i) < high) {
@@ -91,26 +86,6 @@
 		return margin;
 	}
 
-	public double overlappedArea(ITupleReference tuple) {
-		double area = 1.0;
-		double f1, f2;
-
-		for (int i = 0; i < getDim(); i++) {
-			int j = getDim() + i;
-			double low = recDescSers[i].getValue(tuple.getFieldData(i),
-					tuple.getFieldStart(i));
-			double high = recDescSers[j].getValue(tuple.getFieldData(j),
-					tuple.getFieldStart(j));
-			if (getLow(i) > high || getHigh(i) < low) {
-				return 0.0;
-			}
-			f1 = Math.max(getLow(i), low);
-			f2 = Math.min(getHigh(i), high);
-			area *= f2 - f1;
-		}
-		return area;
-	}
-
 	public double overlappedArea(Rectangle rec) {
 		double area = 1.0;
 		double f1, f2;
@@ -119,6 +94,7 @@
 			if (getLow(i) > rec.getHigh(i) || getHigh(i) < rec.getLow(i)) {
 				return 0.0;
 			}
+
 			f1 = Math.max(getLow(i), rec.getLow(i));
 			f2 = Math.min(getHigh(i), rec.getHigh(i));
 			area *= f2 - f1;
@@ -126,18 +102,6 @@
 		return area;
 	}
 
-	public double area(ITupleReference tuple) {
-		double area = 1.0;
-		for (int i = 0; i < getDim(); i++) {
-			int j = getDim() + i;
-			area *= recDescSers[j].getValue(tuple.getFieldData(j),
-					tuple.getFieldStart(j))
-					- recDescSers[i].getValue(tuple.getFieldData(i),
-							tuple.getFieldStart(i));
-		}
-		return area;
-	}
-
 	public double area() {
 		double area = 1.0;
 		for (int i = 0; i < getDim(); i++) {
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/SearchPredicate.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/SearchPredicate.java
index cd3a0ef..c8d5816 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/SearchPredicate.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/SearchPredicate.java
@@ -21,29 +21,29 @@
 
 public class SearchPredicate implements ISearchPredicate {
 
-    private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 1L;
 
-    protected ITupleReference searchKey;
-    protected MultiComparator cmp;
+	protected ITupleReference searchKey;
+	protected MultiComparator cmp;
 
-    public SearchPredicate(ITupleReference searchKey, MultiComparator cmp) {
-        this.searchKey = searchKey;
-        this.cmp = cmp;
-    }
+	public SearchPredicate(ITupleReference searchKey, MultiComparator cmp) {
+		this.searchKey = searchKey;
+		this.cmp = cmp;
+	}
 
-    public ITupleReference getSearchKey() {
-        return searchKey;
-    }
+	public ITupleReference getSearchKey() {
+		return searchKey;
+	}
 
-    public void setSearchKey(ITupleReference searchKey) {
-        this.searchKey = searchKey;
-    }
+	public void setSearchKey(ITupleReference searchKey) {
+		this.searchKey = searchKey;
+	}
 
-    public MultiComparator getLowKeyComparator() {
-        return cmp;
-    }
+	public MultiComparator getLowKeyComparator() {
+		return cmp;
+	}
 
-    public MultiComparator getHighKeyComparator() {
-        return cmp;
-    }
+	public MultiComparator getHighKeyComparator() {
+		return cmp;
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntry.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntry.java
index 0cb3de8..6cb84a4 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntry.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntry.java
@@ -18,35 +18,35 @@
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMFrame;
 
 public class TupleEntry implements Comparable<TupleEntry> {
-    private int tupleIndex;
-    private double value;
+	private int tupleIndex;
+	private double value;
 
-    public TupleEntry() {
-    }
+	public TupleEntry() {
+	}
 
-    public int getTupleIndex() {
-        return tupleIndex;
-    }
+	public int getTupleIndex() {
+		return tupleIndex;
+	}
 
-    public void setTupleIndex(int tupleIndex) {
-        this.tupleIndex = tupleIndex;
-    }
+	public void setTupleIndex(int tupleIndex) {
+		this.tupleIndex = tupleIndex;
+	}
 
-    public double getValue() {
-        return value;
-    }
+	public double getValue() {
+		return value;
+	}
 
-    public void setValue(double value) {
-        this.value = value;
-    }
+	public void setValue(double value) {
+		this.value = value;
+	}
 
-    public int compareTo(TupleEntry tupleEntry) {
-        double cmp = this.getValue() - tupleEntry.getValue();
-        if (cmp > RTreeNSMFrame.doubleEpsilon())
-            return 1;
-        cmp = tupleEntry.getValue() - this.getValue();
-        if (cmp > RTreeNSMFrame.doubleEpsilon())
-            return -1;
-        return 0;
-    }
+	public int compareTo(TupleEntry tupleEntry) {
+		double cmp = this.getValue() - tupleEntry.getValue();
+		if (cmp > RTreeNSMFrame.doubleEpsilon())
+			return 1;
+		cmp = tupleEntry.getValue() - this.getValue();
+		if (cmp > RTreeNSMFrame.doubleEpsilon())
+			return -1;
+		return 0;
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntryArrayList.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntryArrayList.java
index 8be8251..7bd2334 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntryArrayList.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/TupleEntryArrayList.java
@@ -19,61 +19,61 @@
 import java.util.Collections;
 
 public class TupleEntryArrayList {
-    private TupleEntry[] data;
-    private int size;
-    private final int growth;
+	private TupleEntry[] data;
+	private int size;
+	private final int growth;
 
-    public TupleEntryArrayList(int initialCapacity, int growth) {
-        data = new TupleEntry[initialCapacity];
-        size = 0;
-        this.growth = growth;
-    }
+	public TupleEntryArrayList(int initialCapacity, int growth) {
+		data = new TupleEntry[initialCapacity];
+		size = 0;
+		this.growth = growth;
+	}
 
-    public int size() {
-        return size;
-    }
+	public int size() {
+		return size;
+	}
 
-    public void add(int tupleIndex, double value) {
-        if (size == data.length) {
-            TupleEntry[] newData = new TupleEntry[data.length + growth];
-            System.arraycopy(data, 0, newData, 0, data.length);
-            data = newData;
-        }
-        if (data[size] == null) {
-            data[size] = new TupleEntry();
-        }
-        data[size].setTupleIndex(tupleIndex);
-        data[size].setValue(value);
-        size++;
-    }
+	public void add(int tupleIndex, double value) {
+		if (size == data.length) {
+			TupleEntry[] newData = new TupleEntry[data.length + growth];
+			System.arraycopy(data, 0, newData, 0, data.length);
+			data = newData;
+		}
+		if (data[size] == null) {
+			data[size] = new TupleEntry();
+		}
+		data[size].setTupleIndex(tupleIndex);
+		data[size].setValue(value);
+		size++;
+	}
 
-    public void removeLast() {
-        if (size > 0)
-            size--;
-    }
+	public void removeLast() {
+		if (size > 0)
+			size--;
+	}
 
-    // WARNING: caller is responsible for checking size > 0
-    public TupleEntry getLast() {
-        return data[size - 1];
-    }
+	// WARNING: caller is responsible for checking size > 0
+	public TupleEntry getLast() {
+		return data[size - 1];
+	}
 
-    public TupleEntry get(int i) {
-        return data[i];
-    }
+	public TupleEntry get(int i) {
+		return data[i];
+	}
 
-    public void clear() {
-        size = 0;
-    }
+	public void clear() {
+		size = 0;
+	}
 
-    public boolean isEmpty() {
-        return size == 0;
-    }
+	public boolean isEmpty() {
+		return size == 0;
+	}
 
-    public void sort(EntriesOrder order, int tupleCount) {
-        if (order == EntriesOrder.ASCENDING) {
-            Arrays.sort(data, 0, tupleCount);
-        } else {
-            Arrays.sort(data, 0, tupleCount, Collections.reverseOrder());
-        }
-    }
+	public void sort(EntriesOrder order, int tupleCount) {
+		if (order == EntriesOrder.ASCENDING) {
+			Arrays.sort(data, 0, tupleCount);
+		} else {
+			Arrays.sort(data, 0, tupleCount, Collections.reverseOrder());
+		}
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java
index d2b1c53..7badb8e 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java
@@ -24,91 +24,104 @@
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMFrame;
 
 public class UnorderedSlotManager extends AbstractSlotManager {
-    @Override
-    public int findTupleIndex(ITupleReference searchKey, ITreeIndexTupleReference frameTuple, MultiComparator multiCmp,
-            FindTupleMode mode, FindTupleNoExactMatchPolicy matchPolicy) {
+	@Override
+	public int findTupleIndex(ITupleReference searchKey,
+			ITreeIndexTupleReference frameTuple, MultiComparator multiCmp,
+			FindTupleMode mode, FindTupleNoExactMatchPolicy matchPolicy) {
 
-        int maxFieldPos = multiCmp.getKeyFieldCount() / 2;
-        for (int i = 0; i < frame.getTupleCount(); i++) {
-            frameTuple.resetByTupleIndex(frame, i);
+		int maxFieldPos = multiCmp.getKeyFieldCount() / 2;
+		for (int i = 0; i < frame.getTupleCount(); i++) {
+			frameTuple.resetByTupleIndex(frame, i);
 
-            boolean foundTuple = true;
-            for (int j = 0; j < maxFieldPos; j++) {
-                int k = maxFieldPos + j;
-                int c1 = multiCmp.getComparators()[j].compare(frameTuple.getFieldData(j), frameTuple.getFieldStart(j),
-                        frameTuple.getFieldLength(j), searchKey.getFieldData(j), searchKey.getFieldStart(j),
-                        searchKey.getFieldLength(j));
+			boolean foundTuple = true;
+			for (int j = 0; j < maxFieldPos; j++) {
+				int k = maxFieldPos + j;
+				int c1 = multiCmp.getComparators()[j].compare(
+						frameTuple.getFieldData(j),
+						frameTuple.getFieldStart(j),
+						frameTuple.getFieldLength(j),
+						searchKey.getFieldData(j), searchKey.getFieldStart(j),
+						searchKey.getFieldLength(j));
 
-                if (c1 != 0) {
-                    foundTuple = false;
-                    break;
-                }
-                int c2 = multiCmp.getComparators()[k].compare(frameTuple.getFieldData(k), frameTuple.getFieldStart(k),
-                        frameTuple.getFieldLength(k), searchKey.getFieldData(k), searchKey.getFieldStart(k),
-                        searchKey.getFieldLength(k));
-                if (c2 != 0) {
-                    foundTuple = false;
-                    break;
-                }
-            }
-            int remainingFieldCount = multiCmp.getFieldCount() - multiCmp.getKeyFieldCount();
-            for (int j = multiCmp.getKeyFieldCount(); j < multiCmp.getKeyFieldCount() + remainingFieldCount; j++) {
-                if (!compareField(searchKey, frameTuple, j)) {
-                    foundTuple = false;
-                    break;
-                }
-            }
-            if (foundTuple) {
-                return i;
-            }
-        }
-        return -1;
-    }
+				if (c1 != 0) {
+					foundTuple = false;
+					break;
+				}
+				int c2 = multiCmp.getComparators()[k].compare(
+						frameTuple.getFieldData(k),
+						frameTuple.getFieldStart(k),
+						frameTuple.getFieldLength(k),
+						searchKey.getFieldData(k), searchKey.getFieldStart(k),
+						searchKey.getFieldLength(k));
+				if (c2 != 0) {
+					foundTuple = false;
+					break;
+				}
+			}
+			int remainingFieldCount = multiCmp.getFieldCount()
+					- multiCmp.getKeyFieldCount();
+			for (int j = multiCmp.getKeyFieldCount(); j < multiCmp
+					.getKeyFieldCount() + remainingFieldCount; j++) {
+				if (!compareField(searchKey, frameTuple, j)) {
+					foundTuple = false;
+					break;
+				}
+			}
+			if (foundTuple) {
+				return i;
+			}
+		}
+		return -1;
+	}
 
-    public boolean compareField(ITupleReference searchKey, ITreeIndexTupleReference frameTuple, int fIdx) {
-        int searchKeyFieldLength = searchKey.getFieldLength(fIdx);
-        int frameTupleFieldLength = frameTuple.getFieldLength(fIdx);
+	public boolean compareField(ITupleReference searchKey,
+			ITreeIndexTupleReference frameTuple, int fIdx) {
+		int searchKeyFieldLength = searchKey.getFieldLength(fIdx);
+		int frameTupleFieldLength = frameTuple.getFieldLength(fIdx);
 
-        if (searchKeyFieldLength != frameTupleFieldLength) {
-            return false;
-        }
+		if (searchKeyFieldLength != frameTupleFieldLength) {
+			return false;
+		}
 
-        for (int i = 0; i < searchKeyFieldLength; i++) {
-            if (searchKey.getFieldData(fIdx)[i + searchKey.getFieldStart(fIdx)] != frameTuple.getFieldData(fIdx)[i
-                    + frameTuple.getFieldStart(fIdx)]) {
-                return false;
-            }
-        }
-        return true;
-    }
+		for (int i = 0; i < searchKeyFieldLength; i++) {
+			if (searchKey.getFieldData(fIdx)[i + searchKey.getFieldStart(fIdx)] != frameTuple
+					.getFieldData(fIdx)[i + frameTuple.getFieldStart(fIdx)]) {
+				return false;
+			}
+		}
+		return true;
+	}
 
-    @Override
-    public int insertSlot(int tupleIndex, int tupleOff) {
-        int slotOff = getSlotEndOff() - slotSize;
-        setSlot(slotOff, tupleOff);
-        return slotOff;
-    }
+	@Override
+	public int insertSlot(int tupleIndex, int tupleOff) {
+		int slotOff = getSlotEndOff() - slotSize;
+		setSlot(slotOff, tupleOff);
+		return slotOff;
+	}
 
-    public void modifySlot(int slotOff, int tupleOff) {
-        setSlot(slotOff, tupleOff);
-    }
+	public void modifySlot(int slotOff, int tupleOff) {
+		setSlot(slotOff, tupleOff);
+	}
 
-    public void deleteEmptySlots() {
-        int slotOff = getSlotStartOff();
-        while (slotOff >= getSlotEndOff()) {
-            if (frame.getBuffer().getInt(slotOff) == -1) {
-                while (frame.getBuffer().getInt(getSlotEndOff()) == -1) {
-                    ((RTreeNSMFrame) frame).setTupleCount(frame.getTupleCount() - 1);
-                }
-                if (slotOff > getSlotEndOff()) {
-                    System.arraycopy(frame.getBuffer().array(), getSlotEndOff(), frame.getBuffer().array(), slotOff,
-                            slotSize);
-                    ((RTreeNSMFrame) frame).setTupleCount(frame.getTupleCount() - 1);
-                } else {
-                    break;
-                }
-            }
-            slotOff -= slotSize;
-        }
-    }
+	public void deleteEmptySlots() {
+		int slotOff = getSlotStartOff();
+		while (slotOff >= getSlotEndOff()) {
+			if (frame.getBuffer().getInt(slotOff) == -1) {
+				while (frame.getBuffer().getInt(getSlotEndOff()) == -1) {
+					((RTreeNSMFrame) frame)
+							.setTupleCount(frame.getTupleCount() - 1);
+				}
+				if (slotOff > getSlotEndOff()) {
+					System.arraycopy(frame.getBuffer().array(),
+							getSlotEndOff(), frame.getBuffer().array(),
+							slotOff, slotSize);
+					((RTreeNSMFrame) frame)
+							.setTupleCount(frame.getTupleCount() - 1);
+				} else {
+					break;
+				}
+			}
+			slotOff -= slotSize;
+		}
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriter.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriter.java
index 96820c9..6acac7e 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriter.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriter.java
@@ -23,35 +23,36 @@
 
 public class RTreeTypeAwareTupleWriter extends TypeAwareTupleWriter {
 
-    public RTreeTypeAwareTupleWriter(ITypeTrait[] typeTraits) {
-        super(typeTraits);
-    }
+	public RTreeTypeAwareTupleWriter(ITypeTrait[] typeTraits) {
+		super(typeTraits);
+	}
 
-    public int writeTupleFields(ITreeIndexTupleReference[] refs, int startField, ByteBuffer targetBuf, int targetOff) {
-        int runner = targetOff;
-        int nullFlagsBytes = getNullFlagsBytes(refs.length);
-        // write null indicator bits
-        for (int i = 0; i < nullFlagsBytes; i++) {
-            targetBuf.put(runner++, (byte) 0);
-        }
+	public int writeTupleFields(ITreeIndexTupleReference[] refs,
+			int startField, ByteBuffer targetBuf, int targetOff) {
+		int runner = targetOff;
+		int nullFlagsBytes = getNullFlagsBytes(refs.length);
+		// write null indicator bits
+		for (int i = 0; i < nullFlagsBytes; i++) {
+			targetBuf.put(runner++, (byte) 0);
+		}
 
-        // write field slots for variable length fields
-        // since the r-tree has fixed length keys, we don't actually need this?
-        encDec.reset(targetBuf.array(), runner);
-        for (int i = startField; i < startField + refs.length; i++) {
-            if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
-                encDec.encode(refs[i].getFieldLength(i));
-            }
-        }
-        runner = encDec.getPos();
+		// write field slots for variable length fields
+		// since the r-tree has fixed length keys, we don't actually need this?
+		encDec.reset(targetBuf.array(), runner);
+		for (int i = startField; i < startField + refs.length; i++) {
+			if (typeTraits[i].getStaticallyKnownDataLength() == ITypeTrait.VARIABLE_LENGTH) {
+				encDec.encode(refs[i].getFieldLength(i));
+			}
+		}
+		runner = encDec.getPos();
 
-        // write data
-        for (int i = 0; i < refs.length; i++) {
-            System.arraycopy(refs[i].getFieldData(i), refs[i].getFieldStart(i), targetBuf.array(), runner,
-                    refs[i].getFieldLength(i));
-            runner += refs[i].getFieldLength(i);
-        }
-        return runner - targetOff;
+		// write data
+		for (int i = 0; i < refs.length; i++) {
+			System.arraycopy(refs[i].getFieldData(i), refs[i].getFieldStart(i),
+					targetBuf.array(), runner, refs[i].getFieldLength(i));
+			runner += refs[i].getFieldLength(i);
+		}
+		return runner - targetOff;
 
-    }
+	}
 }
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriterFactory.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriterFactory.java
index e2e99c7..7d88f2e 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriterFactory.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/tuples/RTreeTypeAwareTupleWriterFactory.java
@@ -19,18 +19,19 @@
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriter;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriterFactory;
 
-public class RTreeTypeAwareTupleWriterFactory implements ITreeIndexTupleWriterFactory {
+public class RTreeTypeAwareTupleWriterFactory implements
+		ITreeIndexTupleWriterFactory {
 
-    private static final long serialVersionUID = 1L;
-    private ITypeTrait[] typeTraits;
+	private static final long serialVersionUID = 1L;
+	private ITypeTrait[] typeTraits;
 
-    public RTreeTypeAwareTupleWriterFactory(ITypeTrait[] typeTraits) {
-        this.typeTraits = typeTraits;
-    }
+	public RTreeTypeAwareTupleWriterFactory(ITypeTrait[] typeTraits) {
+		this.typeTraits = typeTraits;
+	}
 
-    @Override
-    public ITreeIndexTupleWriter createTupleWriter() {
-        return new RTreeTypeAwareTupleWriter(typeTraits);
-    }
+	@Override
+	public ITreeIndexTupleWriter createTupleWriter() {
+		return new RTreeTypeAwareTupleWriter(typeTraits);
+	}
 
 }
diff --git a/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/AbstractRTreeTest.java b/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/AbstractRTreeTest.java
index b2ab775..25c5370 100644
--- a/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/AbstractRTreeTest.java
+++ b/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/AbstractRTreeTest.java
@@ -23,18 +23,20 @@
 
 public abstract class AbstractRTreeTest {
 
-    protected final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("ddMMyy-hhmmssSS");
-    protected final static String tmpDir = System.getProperty("java.io.tmpdir");
-    protected final static String sep = System.getProperty("file.separator");
-    protected final static String fileName = tmpDir + sep + simpleDateFormat.format(new Date());
+	protected final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
+			"ddMMyy-hhmmssSS");
+	protected final static String tmpDir = System.getProperty("java.io.tmpdir");
+	protected final static String sep = System.getProperty("file.separator");
+	protected final static String fileName = tmpDir + sep
+			+ simpleDateFormat.format(new Date());
 
-    protected void print(String str) {
-        System.err.print(str);
-    }
+	protected void print(String str) {
+		System.err.print(str);
+	}
 
-    @AfterClass
-    public static void cleanup() throws Exception {
-        File f = new File(fileName);
-        f.deleteOnExit();
-    }
+	@AfterClass
+	public static void cleanup() throws Exception {
+		File f = new File(fileName);
+		f.deleteOnExit();
+	}
 }
diff --git a/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/RTreeTest.java b/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/RTreeTest.java
index 630c77a..907d5dc 100644
--- a/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/RTreeTest.java
+++ b/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/RTreeTest.java
@@ -40,6 +40,7 @@
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
@@ -54,6 +55,8 @@
 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeFrame;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
+import edu.uci.ics.hyracks.storage.am.rtree.impls.IntegerPrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTree;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTreeOpContext;
 import edu.uci.ics.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriterFactory;
@@ -107,25 +110,24 @@
 		typeTraits[5] = new TypeTrait(4);
 		typeTraits[6] = new TypeTrait(8);
 
-		MultiComparator cmp = new MultiComparator(typeTraits, cmps);
+		// declare value providers
+		IPrimitiveValueProvider[] valueProviders = new IPrimitiveValueProvider[keyFieldCount];
+		valueProviders[0] = DoublePrimitiveValueProviderFactory.INSTANCE
+				.createPrimitiveValueProvider();
+		valueProviders[1] = valueProviders[0];
+		valueProviders[2] = valueProviders[0];
+		valueProviders[3] = valueProviders[0];
+
+		MultiComparator cmp = new MultiComparator(typeTraits, cmps,
+				valueProviders);
 
 		RTreeTypeAwareTupleWriterFactory tupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 				typeTraits);
 
-		@SuppressWarnings("rawtypes")
-		ISerializerDeserializer[] recDescSers = {
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE };
-
 		ITreeIndexFrameFactory interiorFrameFactory = new RTreeNSMInteriorFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexFrameFactory leafFrameFactory = new RTreeNSMLeafFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
 		ITreeIndexMetaDataFrame metaFrame = metaFrameFactory.createFrame();
 
@@ -145,6 +147,15 @@
 		ArrayTupleBuilder tb = new ArrayTupleBuilder(cmp.getFieldCount());
 		DataOutput dos = tb.getDataOutput();
 
+		@SuppressWarnings("rawtypes")
+		ISerializerDeserializer[] recDescSers = {
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE };
 		RecordDescriptor recDesc = new RecordDescriptor(recDescSers);
 		IFrameTupleAccessor accessor = new FrameTupleAccessor(
 				ctx.getFrameSize(), recDesc);
@@ -251,190 +262,10 @@
 	}
 
 	// create an R-tree of two dimensions
-	// fill the R-tree with random integer key values using insertions
-	// perform ordered scan
-	@Test
-	public void test02() throws Exception {
-
-		TestStorageManagerComponentHolder.init(PAGE_SIZE, NUM_PAGES,
-				MAX_OPEN_FILES);
-		IBufferCache bufferCache = TestStorageManagerComponentHolder
-				.getBufferCache(ctx);
-		IFileMapProvider fmp = TestStorageManagerComponentHolder
-				.getFileMapProvider(ctx);
-		FileReference file = new FileReference(new File(fileName));
-		bufferCache.createFile(file);
-		int fileId = fmp.lookupFileId(file);
-		bufferCache.openFile(fileId);
-
-		// declare keys
-		int keyFieldCount = 4;
-		IBinaryComparator[] cmps = new IBinaryComparator[keyFieldCount];
-		cmps[0] = IntegerBinaryComparatorFactory.INSTANCE
-				.createBinaryComparator();
-		cmps[1] = cmps[0];
-		cmps[2] = cmps[0];
-		cmps[3] = cmps[0];
-
-		// declare tuple fields
-		int fieldCount = 7;
-		ITypeTrait[] typeTraits = new ITypeTrait[fieldCount];
-		typeTraits[0] = new TypeTrait(4);
-		typeTraits[1] = new TypeTrait(4);
-		typeTraits[2] = new TypeTrait(4);
-		typeTraits[3] = new TypeTrait(4);
-		typeTraits[4] = new TypeTrait(8);
-		typeTraits[5] = new TypeTrait(4);
-		typeTraits[6] = new TypeTrait(8);
-
-		MultiComparator cmp = new MultiComparator(typeTraits, cmps);
-
-		RTreeTypeAwareTupleWriterFactory tupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
-				typeTraits);
-
-		@SuppressWarnings("rawtypes")
-		ISerializerDeserializer[] recDescSers = {
-				IntegerSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE };
-
-		ITreeIndexFrameFactory interiorFrameFactory = new RTreeNSMInteriorFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
-		ITreeIndexFrameFactory leafFrameFactory = new RTreeNSMLeafFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
-		ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
-		ITreeIndexMetaDataFrame metaFrame = metaFrameFactory.createFrame();
-
-		IRTreeFrame interiorFrame = (IRTreeFrame) interiorFrameFactory
-				.createFrame();
-		IRTreeFrame leafFrame = (IRTreeFrame) leafFrameFactory.createFrame();
-		IFreePageManager freePageManager = new LinkedListFreePageManager(
-				bufferCache, fileId, 0, metaFrameFactory);
-
-		RTree rtree = new RTree(bufferCache, freePageManager,
-				interiorFrameFactory, leafFrameFactory, cmp);
-		rtree.create(fileId, leafFrame, metaFrame);
-		rtree.open(fileId);
-
-		ByteBuffer hyracksFrame = ctx.allocateFrame();
-		FrameTupleAppender appender = new FrameTupleAppender(ctx.getFrameSize());
-		ArrayTupleBuilder tb = new ArrayTupleBuilder(cmp.getFieldCount());
-		DataOutput dos = tb.getDataOutput();
-
-		RecordDescriptor recDesc = new RecordDescriptor(recDescSers);
-		IFrameTupleAccessor accessor = new FrameTupleAccessor(
-				ctx.getFrameSize(), recDesc);
-		accessor.reset(hyracksFrame);
-		FrameTupleReference tuple = new FrameTupleReference();
-
-		RTreeOpContext insertOpCtx = rtree.createOpContext(IndexOp.INSERT,
-				leafFrame, interiorFrame, metaFrame);
-
-		Random rnd = new Random();
-		rnd.setSeed(50);
-
-		Random rnd2 = new Random();
-		rnd2.setSeed(50);
-		for (int i = 0; i < 5000; i++) {
-
-			int p1x = rnd.nextInt();
-			int p1y = rnd.nextInt();
-			int p2x = rnd.nextInt();
-			int p2y = rnd.nextInt();
-
-			double pk1 = rnd2.nextDouble();
-			int pk2 = rnd2.nextInt();
-			double pk3 = rnd2.nextDouble();
-
-			tb.reset();
-			IntegerSerializerDeserializer.INSTANCE.serialize(
-					Math.min(p1x, p2x), dos);
-			tb.addFieldEndOffset();
-			IntegerSerializerDeserializer.INSTANCE.serialize(
-					Math.min(p1y, p2y), dos);
-			tb.addFieldEndOffset();
-			IntegerSerializerDeserializer.INSTANCE.serialize(
-					Math.max(p1x, p2x), dos);
-			tb.addFieldEndOffset();
-			IntegerSerializerDeserializer.INSTANCE.serialize(
-					Math.max(p1y, p2y), dos);
-			tb.addFieldEndOffset();
-			DoubleSerializerDeserializer.INSTANCE.serialize(pk1, dos);
-			tb.addFieldEndOffset();
-			IntegerSerializerDeserializer.INSTANCE.serialize(pk2, dos);
-			tb.addFieldEndOffset();
-			DoubleSerializerDeserializer.INSTANCE.serialize(pk3, dos);
-			tb.addFieldEndOffset();
-
-			appender.reset(hyracksFrame, true);
-			appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0,
-					tb.getSize());
-
-			tuple.reset(accessor, 0);
-
-			if (i % 1000 == 0) {
-				print("INSERTING " + i + " " + Math.min(p1x, p2x) + " "
-						+ Math.min(p1y, p2y) + " " + Math.max(p1x, p2x) + " "
-						+ Math.max(p1y, p2y) + "\n");
-			}
-
-			try {
-				rtree.insert(tuple, insertOpCtx);
-			} catch (TreeIndexException e) {
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-
-		// rtree.printTree(leafFrame, interiorFrame, recDescSers);
-		// System.err.println();
-
-		String rtreeStats = rtree.printStats();
-		print(rtreeStats);
-
-		// disk-order scan
-		print("DISK-ORDER SCAN:\n");
-		TreeDiskOrderScanCursor diskOrderCursor = new TreeDiskOrderScanCursor(
-				leafFrame);
-		RTreeOpContext diskOrderScanOpCtx = rtree.createOpContext(
-				IndexOp.DISKORDERSCAN, leafFrame, null, null);
-		rtree.diskOrderScan(diskOrderCursor, leafFrame, metaFrame,
-				diskOrderScanOpCtx);
-		try {
-			while (diskOrderCursor.hasNext()) {
-				diskOrderCursor.next();
-				ITupleReference frameTuple = diskOrderCursor.getTuple();
-				String rec = cmp.printTuple(frameTuple, recDescSers);
-				print(rec + "\n");
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			diskOrderCursor.close();
-		}
-
-		TreeIndexStatsGatherer statsGatherer = new TreeIndexStatsGatherer(
-				bufferCache, freePageManager, fileId, rtree.getRootPageId());
-		TreeIndexStats stats = statsGatherer.gatherStats(leafFrame,
-				interiorFrame, metaFrame);
-		String string = stats.toString();
-		System.err.println(string);
-
-		rtree.close();
-		bufferCache.closeFile(fileId);
-		bufferCache.close();
-
-	}
-
-	// create an R-tree of two dimensions
 	// fill the R-tree with random values using insertions
 	// and then delete all the tuples which result of an empty R-tree
 	@Test
-	public void test03() throws Exception {
+	public void test02() throws Exception {
 
 		TestStorageManagerComponentHolder.init(PAGE_SIZE, NUM_PAGES,
 				MAX_OPEN_FILES);
@@ -467,24 +298,24 @@
 		typeTraits[5] = new TypeTrait(4);
 		typeTraits[6] = new TypeTrait(8);
 
-		MultiComparator cmp = new MultiComparator(typeTraits, cmps);
+		// declare value providers
+		IPrimitiveValueProvider[] valueProviders = new IPrimitiveValueProvider[keyFieldCount];
+		valueProviders[0] = DoublePrimitiveValueProviderFactory.INSTANCE
+				.createPrimitiveValueProvider();
+		valueProviders[1] = valueProviders[0];
+		valueProviders[2] = valueProviders[0];
+		valueProviders[3] = valueProviders[0];
+
+		MultiComparator cmp = new MultiComparator(typeTraits, cmps,
+				valueProviders);
 
 		RTreeTypeAwareTupleWriterFactory tupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 				typeTraits);
 
-		@SuppressWarnings("rawtypes")
-		ISerializerDeserializer[] recDescSers = {
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE };
 		ITreeIndexFrameFactory interiorFrameFactory = new RTreeNSMInteriorFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexFrameFactory leafFrameFactory = new RTreeNSMLeafFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
 		ITreeIndexMetaDataFrame metaFrame = metaFrameFactory.createFrame();
 
@@ -504,6 +335,15 @@
 		ArrayTupleBuilder tb = new ArrayTupleBuilder(cmp.getFieldCount());
 		DataOutput dos = tb.getDataOutput();
 
+		@SuppressWarnings("rawtypes")
+		ISerializerDeserializer[] recDescSers = {
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE };
 		RecordDescriptor recDesc = new RecordDescriptor(recDescSers);
 		IFrameTupleAccessor accessor = new FrameTupleAccessor(
 				ctx.getFrameSize(), recDesc);
@@ -645,7 +485,7 @@
 	// fill the R-tree with random values using insertions
 	// perform ordered scan
 	@Test
-	public void test04() throws Exception {
+	public void test03() throws Exception {
 
 		TestStorageManagerComponentHolder.init(PAGE_SIZE, NUM_PAGES,
 				MAX_OPEN_FILES);
@@ -682,26 +522,26 @@
 		typeTraits[7] = new TypeTrait(4);
 		typeTraits[8] = new TypeTrait(8);
 
-		MultiComparator cmp = new MultiComparator(typeTraits, cmps);
+		// declare value providers
+		IPrimitiveValueProvider[] valueProviders = new IPrimitiveValueProvider[keyFieldCount];
+		valueProviders[0] = DoublePrimitiveValueProviderFactory.INSTANCE
+				.createPrimitiveValueProvider();
+		valueProviders[1] = valueProviders[0];
+		valueProviders[2] = valueProviders[0];
+		valueProviders[3] = valueProviders[0];
+		valueProviders[4] = valueProviders[0];
+		valueProviders[5] = valueProviders[0];
+
+		MultiComparator cmp = new MultiComparator(typeTraits, cmps,
+				valueProviders);
 
 		RTreeTypeAwareTupleWriterFactory tupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 				typeTraits);
 
-		@SuppressWarnings("rawtypes")
-		ISerializerDeserializer[] recDescSers = {
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE };
 		ITreeIndexFrameFactory interiorFrameFactory = new RTreeNSMInteriorFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexFrameFactory leafFrameFactory = new RTreeNSMLeafFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
 		ITreeIndexMetaDataFrame metaFrame = metaFrameFactory.createFrame();
 
@@ -721,6 +561,17 @@
 		ArrayTupleBuilder tb = new ArrayTupleBuilder(cmp.getFieldCount());
 		DataOutput dos = tb.getDataOutput();
 
+		@SuppressWarnings("rawtypes")
+		ISerializerDeserializer[] recDescSers = {
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE };
 		RecordDescriptor recDesc = new RecordDescriptor(recDescSers);
 		IFrameTupleAccessor accessor = new FrameTupleAccessor(
 				ctx.getFrameSize(), recDesc);
@@ -832,4 +683,192 @@
 		bufferCache.close();
 
 	}
+
+	// create an R-tree of two dimensions
+	// fill the R-tree with random integer key values using insertions
+	// perform ordered scan
+	@Test
+	public void test04() throws Exception {
+
+		TestStorageManagerComponentHolder.init(PAGE_SIZE, NUM_PAGES,
+				MAX_OPEN_FILES);
+		IBufferCache bufferCache = TestStorageManagerComponentHolder
+				.getBufferCache(ctx);
+		IFileMapProvider fmp = TestStorageManagerComponentHolder
+				.getFileMapProvider(ctx);
+		FileReference file = new FileReference(new File(fileName));
+		bufferCache.createFile(file);
+		int fileId = fmp.lookupFileId(file);
+		bufferCache.openFile(fileId);
+
+		// declare keys
+		int keyFieldCount = 4;
+		IBinaryComparator[] cmps = new IBinaryComparator[keyFieldCount];
+		cmps[0] = IntegerBinaryComparatorFactory.INSTANCE
+				.createBinaryComparator();
+		cmps[1] = cmps[0];
+		cmps[2] = cmps[0];
+		cmps[3] = cmps[0];
+
+		// declare tuple fields
+		int fieldCount = 7;
+		ITypeTrait[] typeTraits = new ITypeTrait[fieldCount];
+		typeTraits[0] = new TypeTrait(4);
+		typeTraits[1] = new TypeTrait(4);
+		typeTraits[2] = new TypeTrait(4);
+		typeTraits[3] = new TypeTrait(4);
+		typeTraits[4] = new TypeTrait(8);
+		typeTraits[5] = new TypeTrait(4);
+		typeTraits[6] = new TypeTrait(8);
+
+		// declare value providers
+		IPrimitiveValueProvider[] valueProviders = new IPrimitiveValueProvider[keyFieldCount];
+		valueProviders[0] = IntegerPrimitiveValueProviderFactory.INSTANCE
+				.createPrimitiveValueProvider();
+		valueProviders[1] = valueProviders[0];
+		valueProviders[2] = valueProviders[0];
+		valueProviders[3] = valueProviders[0];
+
+		MultiComparator cmp = new MultiComparator(typeTraits, cmps,
+				valueProviders);
+
+		RTreeTypeAwareTupleWriterFactory tupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
+				typeTraits);
+
+		ITreeIndexFrameFactory interiorFrameFactory = new RTreeNSMInteriorFrameFactory(
+				tupleWriterFactory, keyFieldCount);
+		ITreeIndexFrameFactory leafFrameFactory = new RTreeNSMLeafFrameFactory(
+				tupleWriterFactory, keyFieldCount);
+		ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
+		ITreeIndexMetaDataFrame metaFrame = metaFrameFactory.createFrame();
+
+		IRTreeFrame interiorFrame = (IRTreeFrame) interiorFrameFactory
+				.createFrame();
+		IRTreeFrame leafFrame = (IRTreeFrame) leafFrameFactory.createFrame();
+		IFreePageManager freePageManager = new LinkedListFreePageManager(
+				bufferCache, fileId, 0, metaFrameFactory);
+
+		RTree rtree = new RTree(bufferCache, freePageManager,
+				interiorFrameFactory, leafFrameFactory, cmp);
+		rtree.create(fileId, leafFrame, metaFrame);
+		rtree.open(fileId);
+
+		ByteBuffer hyracksFrame = ctx.allocateFrame();
+		FrameTupleAppender appender = new FrameTupleAppender(ctx.getFrameSize());
+		ArrayTupleBuilder tb = new ArrayTupleBuilder(cmp.getFieldCount());
+		DataOutput dos = tb.getDataOutput();
+
+		@SuppressWarnings("rawtypes")
+		ISerializerDeserializer[] recDescSers = {
+				IntegerSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE };
+		RecordDescriptor recDesc = new RecordDescriptor(recDescSers);
+		IFrameTupleAccessor accessor = new FrameTupleAccessor(
+				ctx.getFrameSize(), recDesc);
+		accessor.reset(hyracksFrame);
+		FrameTupleReference tuple = new FrameTupleReference();
+
+		RTreeOpContext insertOpCtx = rtree.createOpContext(IndexOp.INSERT,
+				leafFrame, interiorFrame, metaFrame);
+
+		Random rnd = new Random();
+		rnd.setSeed(50);
+
+		Random rnd2 = new Random();
+		rnd2.setSeed(50);
+		for (int i = 0; i < 5000; i++) {
+
+			int p1x = rnd.nextInt();
+			int p1y = rnd.nextInt();
+			int p2x = rnd.nextInt();
+			int p2y = rnd.nextInt();
+
+			double pk1 = rnd2.nextDouble();
+			int pk2 = rnd2.nextInt();
+			double pk3 = rnd2.nextDouble();
+
+			tb.reset();
+			IntegerSerializerDeserializer.INSTANCE.serialize(
+					Math.min(p1x, p2x), dos);
+			tb.addFieldEndOffset();
+			IntegerSerializerDeserializer.INSTANCE.serialize(
+					Math.min(p1y, p2y), dos);
+			tb.addFieldEndOffset();
+			IntegerSerializerDeserializer.INSTANCE.serialize(
+					Math.max(p1x, p2x), dos);
+			tb.addFieldEndOffset();
+			IntegerSerializerDeserializer.INSTANCE.serialize(
+					Math.max(p1y, p2y), dos);
+			tb.addFieldEndOffset();
+			DoubleSerializerDeserializer.INSTANCE.serialize(pk1, dos);
+			tb.addFieldEndOffset();
+			IntegerSerializerDeserializer.INSTANCE.serialize(pk2, dos);
+			tb.addFieldEndOffset();
+			DoubleSerializerDeserializer.INSTANCE.serialize(pk3, dos);
+			tb.addFieldEndOffset();
+
+			appender.reset(hyracksFrame, true);
+			appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0,
+					tb.getSize());
+
+			tuple.reset(accessor, 0);
+
+			if (i % 1000 == 0) {
+				print("INSERTING " + i + " " + Math.min(p1x, p2x) + " "
+						+ Math.min(p1y, p2y) + " " + Math.max(p1x, p2x) + " "
+						+ Math.max(p1y, p2y) + "\n");
+			}
+
+			try {
+				rtree.insert(tuple, insertOpCtx);
+			} catch (TreeIndexException e) {
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+
+		// rtree.printTree(leafFrame, interiorFrame, recDescSers);
+		// System.err.println();
+
+		String rtreeStats = rtree.printStats();
+		print(rtreeStats);
+
+		// disk-order scan
+		print("DISK-ORDER SCAN:\n");
+		TreeDiskOrderScanCursor diskOrderCursor = new TreeDiskOrderScanCursor(
+				leafFrame);
+		RTreeOpContext diskOrderScanOpCtx = rtree.createOpContext(
+				IndexOp.DISKORDERSCAN, leafFrame, null, null);
+		rtree.diskOrderScan(diskOrderCursor, leafFrame, metaFrame,
+				diskOrderScanOpCtx);
+		try {
+			while (diskOrderCursor.hasNext()) {
+				diskOrderCursor.next();
+				ITupleReference frameTuple = diskOrderCursor.getTuple();
+				String rec = cmp.printTuple(frameTuple, recDescSers);
+				print(rec + "\n");
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			diskOrderCursor.close();
+		}
+
+		TreeIndexStatsGatherer statsGatherer = new TreeIndexStatsGatherer(
+				bufferCache, freePageManager, fileId, rtree.getRootPageId());
+		TreeIndexStats stats = statsGatherer.gatherStats(leafFrame,
+				interiorFrame, metaFrame);
+		String string = stats.toString();
+		System.err.println(string);
+
+		rtree.close();
+		bufferCache.closeFile(fileId);
+		bufferCache.close();
+
+	}
 }
\ No newline at end of file
diff --git a/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/SearchCursorTest.java b/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/SearchCursorTest.java
index 09305be..b04afe5 100644
--- a/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/SearchCursorTest.java
+++ b/hyracks-tests/hyracks-storage-am-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/rtree/SearchCursorTest.java
@@ -43,6 +43,7 @@
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
+import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProvider;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
@@ -56,6 +57,7 @@
 import edu.uci.ics.hyracks.storage.am.rtree.api.IRTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrameFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreeNSMLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTree;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTreeOpContext;
 import edu.uci.ics.hyracks.storage.am.rtree.impls.RTreeSearchCursor;
@@ -108,23 +110,24 @@
 		typeTraits[3] = new TypeTrait(8);
 		typeTraits[4] = new TypeTrait(4);
 
-		MultiComparator cmp = new MultiComparator(typeTraits, cmps);
+		// declare value providers
+		IPrimitiveValueProvider[] valueProviders = new IPrimitiveValueProvider[keyFieldCount];
+		valueProviders[0] = DoublePrimitiveValueProviderFactory.INSTANCE
+				.createPrimitiveValueProvider();
+		valueProviders[1] = valueProviders[0];
+		valueProviders[2] = valueProviders[0];
+		valueProviders[3] = valueProviders[0];
+
+		MultiComparator cmp = new MultiComparator(typeTraits, cmps,
+				valueProviders);
 
 		RTreeTypeAwareTupleWriterFactory tupleWriterFactory = new RTreeTypeAwareTupleWriterFactory(
 				typeTraits);
 
-		@SuppressWarnings("rawtypes")
-		ISerializerDeserializer[] recDescSers = {
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				DoubleSerializerDeserializer.INSTANCE,
-				IntegerSerializerDeserializer.INSTANCE };
-
 		ITreeIndexFrameFactory interiorFrameFactory = new RTreeNSMInteriorFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexFrameFactory leafFrameFactory = new RTreeNSMLeafFrameFactory(
-				tupleWriterFactory, recDescSers, keyFieldCount);
+				tupleWriterFactory, keyFieldCount);
 		ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
 		ITreeIndexMetaDataFrame metaFrame = metaFrameFactory.createFrame();
 
@@ -145,6 +148,13 @@
 		ArrayTupleBuilder tb = new ArrayTupleBuilder(cmp.getFieldCount());
 		DataOutput dos = tb.getDataOutput();
 
+		@SuppressWarnings("rawtypes")
+		ISerializerDeserializer[] recDescSers = {
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				DoubleSerializerDeserializer.INSTANCE,
+				IntegerSerializerDeserializer.INSTANCE };
 		RecordDescriptor recDesc = new RecordDescriptor(recDescSers);
 		IFrameTupleAccessor accessor = new FrameTupleAccessor(
 				ctx.getFrameSize(), recDesc);
@@ -271,4 +281,4 @@
 		bufferCache.closeFile(fileId);
 		bufferCache.close();
 	}
-}
+}
\ No newline at end of file
