reorgainzed files into appropriate packages

git-svn-id: https://hyracks.googlecode.com/svn/trunk@96 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrame.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrame.java
index ea7c211..da5a39a 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrame.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrame.java
@@ -18,6 +18,7 @@
 import java.nio.ByteBuffer;
 
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SpaceStatus;
 import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameFactory.java
deleted file mode 100644
index d77a4a0..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameFactory.java
+++ /dev/null
@@ -1,20 +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.btree.api;
-
-public interface IBTreeFrameFactory {	
-	public IBTreeFrame getFrame(ISlotManager slotManager);
-}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameInteriorFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameInteriorFactory.java
deleted file mode 100644
index d0bce0f..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameInteriorFactory.java
+++ /dev/null
@@ -1,20 +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.btree.api;
-
-public interface IBTreeFrameInteriorFactory {	
-	public IBTreeFrameInterior getFrame();
-}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameMetaFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameMetaFactory.java
deleted file mode 100644
index 1d765a2..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameMetaFactory.java
+++ /dev/null
@@ -1,20 +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.btree.api;
-
-public interface IBTreeFrameMetaFactory {   
-    public IBTreeFrameMeta getFrame();
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameInterior.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeInteriorFrame.java
similarity index 94%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameInterior.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeInteriorFrame.java
index a42a63a..ede5adf 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameInterior.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeInteriorFrame.java
@@ -18,7 +18,7 @@
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.RangePredicate;
 
-public interface IBTreeFrameInterior extends IBTreeFrame {
+public interface IBTreeInteriorFrame extends IBTreeFrame {
 	//public int getChildPageId(IFieldAccessor[] fields, MultiComparator cmp);
 	public int getChildPageId(RangePredicate pred, MultiComparator srcCmp);
 	public int getLeftmostChildPageId(MultiComparator cmp);
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeInteriorFrameFactory.java
similarity index 88%
copy from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java
copy to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeInteriorFrameFactory.java
index 6efa32b..a9d7805 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeInteriorFrameFactory.java
@@ -15,6 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.api;
 
-public interface IBTreeFrameLeafFactory {	
-	public IBTreeFrameLeaf getFrame();
-}
\ No newline at end of file
+public interface IBTreeInteriorFrameFactory {	
+	public IBTreeInteriorFrame getFrame();
+}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeaf.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeLeafFrame.java
similarity index 93%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeaf.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeLeafFrame.java
index 94f6cbc..3802710 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeaf.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeLeafFrame.java
@@ -15,7 +15,7 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.api;
 
-public interface IBTreeFrameLeaf extends IBTreeFrame {	
+public interface IBTreeLeafFrame extends IBTreeFrame {	
 	public void setNextLeaf(int nextPage);
 	public int getNextLeaf();
 	
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeLeafFrameFactory.java
similarity index 89%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeLeafFrameFactory.java
index 6efa32b..591f81d 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeLeafFrameFactory.java
@@ -15,6 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.api;
 
-public interface IBTreeFrameLeafFactory {	
-	public IBTreeFrameLeaf getFrame();
+public interface IBTreeLeafFrameFactory {	
+	public IBTreeLeafFrame getFrame();
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameMeta.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeMetaDataFrame.java
similarity index 96%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameMeta.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeMetaDataFrame.java
index fe07702..975ee10 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameMeta.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeMetaDataFrame.java
@@ -17,7 +17,7 @@
 
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
-public interface IBTreeFrameMeta {
+public interface IBTreeMetaDataFrame {
     public void initBuffer(int level);
     
     public void setPage(ICachedPage page);
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeMetaDataFrameFactory.java
similarity index 88%
copy from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java
copy to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeMetaDataFrameFactory.java
index 6efa32b..bc9dea5 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeFrameLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeMetaDataFrameFactory.java
@@ -15,6 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.api;
 
-public interface IBTreeFrameLeafFactory {	
-	public IBTreeFrameLeaf getFrame();
+public interface IBTreeMetaDataFrameFactory {   
+    public IBTreeMetaDataFrame getFrame();
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeSlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeSlotManager.java
deleted file mode 100644
index f1f5949..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IBTreeSlotManager.java
+++ /dev/null
@@ -1,67 +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.btree.api;
-
-import java.nio.ByteBuffer;
-
-import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
-
-// a slot consists of two fields:
-// first field is 1 byte, it indicates the slot number of a prefix record
-// we call the first field prefixSlotOff
-// second field is 3 bytes, it points to the start offset of a record
-// we call the second field recOff
-
-// we distinguish between two slot types:
-// prefix slots that point to prefix records, 
-// a frame is assumed to have a field numPrefixRecords
-// record slots that point to data records
-// a frame is assumed to have a field numRecords
-// a record slot contains a record pointer and a pointer to a prefix slot (prefix slot number) 
-
-// INSERT procedure
-// a record insertion may use an existing prefix record 
-// a record insertion may never create a new prefix record
-// modifying the prefix slots would be extremely expensive because: 
-// potentially all records slots would have to change their prefix slot pointers
-// all prefixes are recomputed during a reorg or compaction
-
-public interface IBTreeSlotManager {
-	public void setFrame(IBTreeFrame frame);		
-	
-	public int decodeFirstSlotField(int slot);
-	public int decodeSecondSlotField(int slot);		
-	public int encodeSlotFields(int firstField, int secondField);
-	
-	// TODO: first argument can be removed. frame must be set and buffer can be gotten from there
-	public int findSlot(ByteBuffer buf, byte[] data, MultiComparator multiCmp, boolean exact);
-	public int insertSlot(int slotOff, int recOff);
-					
-	public int getRecSlotStartOff();
-	public int getRecSlotEndOff();
-	
-	public int getPrefixSlotStartOff();
-	public int getPrefixSlotEndOff();
-	
-	public int getRecSlotOff(int slotNum);
-	public int getPrefixSlotOff(int slotNum);	
-		
-	public int getSlotSize();		
-	
-	// functions for testing
-	public void setPrefixSlot(int slotNum, int slot);
-	
-}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java
index d652daa..9a8a050 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java
@@ -47,8 +47,7 @@
 	public int decodeSecondSlotField(int slot);		
 	public int encodeSlotFields(int firstField, int secondField);
 	
-	// TODO: first argument can be removed. frame must be set and buffer can be gotten from there
-	public int findSlot(ByteBuffer buf, byte[] data, MultiComparator multiCmp, boolean exact);	
+	public int findSlot(byte[] data, MultiComparator multiCmp, boolean exact);
 	public int insertSlot(int slot, int recOff);
 					
 	// returns prefix slot number, returns RECORD_UNCOMPRESSED if none found
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManager.java
index 4a6b784..b92f9e1 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManager.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManager.java
@@ -15,16 +15,12 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.api;
 
-import java.nio.ByteBuffer;
-
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 
-
 public interface ISlotManager {
 	public void setFrame(IBTreeFrame frame);
 	
-	// TODO: first argument can be removed. frame must be set and buffer can be gotten from there
-	public int findSlot(ByteBuffer buf, byte[] data, MultiComparator multiCmp, boolean exact);
+	public int findSlot(byte[] data, MultiComparator multiCmp, boolean exact);
 	public int insertSlot(int slotOff, int recOff);
 	
 	public int getSlotStartOff();
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManagerFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManagerFactory.java
deleted file mode 100644
index ef382c6..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/ISlotManagerFactory.java
+++ /dev/null
@@ -1,20 +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.btree.api;
-
-public interface ISlotManagerFactory {
-	public ISlotManager getSlotManager();
-}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeMeta.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMeta.java
similarity index 95%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeMeta.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMeta.java
index f12639a..44f7f1c 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeMeta.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMeta.java
@@ -13,11 +13,11 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
 import java.nio.ByteBuffer;
 
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMeta;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 // all meta pages of this kind have a negative level
@@ -25,7 +25,7 @@
 // the first meta page is special because it guarantees to have a correct max page
 // other meta pages (i.e., with level -2) have junk in the max page field
 
-public class BTreeMeta implements IBTreeFrameMeta {
+public class BTreeMeta implements IBTreeMetaDataFrame {
         
     protected static final int numRecordsOff = 0;             
     protected static final int freeSpaceOff = numRecordsOff + 4;
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeMetaFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMetaFactory.java
similarity index 68%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeMetaFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMetaFactory.java
index da21326..01058c9 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeMetaFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMetaFactory.java
@@ -13,14 +13,14 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMeta;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMetaFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrameFactory;
 
-public class BTreeMetaFactory implements IBTreeFrameMetaFactory {
+public class BTreeMetaFactory implements IBTreeMetaDataFrameFactory {
     @Override
-    public IBTreeFrameMeta getFrame() {     
+    public IBTreeMetaDataFrame getFrame() {     
         return new BTreeMeta();
     }   
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSM.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSM.java
similarity index 93%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSM.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSM.java
index ca0b1dd..a4978a8 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSM.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSM.java
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -21,7 +21,11 @@
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.ISlotManager;
-import edu.uci.ics.hyracks.storage.am.btree.api.SpaceStatus;
+import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeException;
+import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
+import edu.uci.ics.hyracks.storage.am.btree.impls.OrderedSlotManager;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SlotOffRecOff;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SpaceStatus;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
 public abstract class BTreeNSM implements IBTreeFrame {
@@ -134,7 +138,7 @@
 
 	@Override
 	public void delete(byte[] data, MultiComparator cmp, boolean exactDelete) throws Exception {		
-		int slotOff = slotManager.findSlot(buf, data, cmp, true);
+		int slotOff = slotManager.findSlot(data, cmp, true);
 		if(slotOff < 0) {
 			throw new BTreeException("Key to be deleted does not exist.");
 		}
@@ -187,7 +191,7 @@
 	
 	@Override
 	public void insert(byte[] data, MultiComparator cmp) throws Exception {
-		int slotOff = slotManager.findSlot(buf, data, cmp, false);
+		int slotOff = slotManager.findSlot(data, cmp, false);
 		slotOff = slotManager.insertSlot(slotOff, buf.getInt(freeSpaceOff));
 		
 		int recOff = buf.getInt(freeSpaceOff);
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMInterior.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInterior.java
similarity index 94%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMInterior.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInterior.java
index 87f4070..f48a751 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMInterior.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInterior.java
@@ -13,16 +13,21 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collections;
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrame;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInterior;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
+import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeException;
+import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
+import edu.uci.ics.hyracks.storage.am.btree.impls.RangePredicate;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SlotOffRecOff;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 
-public class BTreeNSMInterior extends BTreeNSM implements IBTreeFrameInterior {
+public class BTreeNSMInterior extends BTreeNSM implements IBTreeInteriorFrame {
 		
 	private static final int rightLeafOff = smFlagOff + 1;
 	
@@ -48,7 +53,7 @@
 	@Override
 	public void insert(byte[] data, MultiComparator cmp) throws Exception {
 		
-		int slotOff = slotManager.findSlot(buf, data, cmp, false);
+		int slotOff = slotManager.findSlot(data, cmp, false);
 		boolean isDuplicate = true;
 		
 		if(slotOff < 0) isDuplicate = false; // greater than all existing keys
@@ -104,7 +109,7 @@
 	@Override
 	public int split(IBTreeFrame rightFrame, byte[] data, MultiComparator cmp, SplitKey splitKey) throws Exception {		
 		// before doing anything check if key already exists
-		int slotOff = slotManager.findSlot(buf, data, cmp, true);
+		int slotOff = slotManager.findSlot(data, cmp, true);
 		if(slotOff >= 0) {
 			if(cmp.compare(data, 0, buf.array(), slotManager.getRecOff(slotOff)) == 0) {				
 				throw new BTreeException("Inserting duplicate key in interior node during split");				
@@ -214,7 +219,7 @@
 		}
 		
 		MultiComparator targetCmp = pred.getComparator();
-		int slotOff = slotManager.findSlot(buf, data, targetCmp, false);
+		int slotOff = slotManager.findSlot(data, targetCmp, false);
 		if(slotOff < 0) {
 			return buf.getInt(rightLeafOff);
 		}
@@ -249,7 +254,7 @@
 	
 	@Override
 	public void delete(byte[] data, MultiComparator cmp, boolean exactDelete) throws Exception {
-		int slotOff = slotManager.findSlot(buf, data, cmp, false);
+		int slotOff = slotManager.findSlot(data, cmp, false);
 		int recOff;
 		int keySize;
 		
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMInteriorFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInteriorFactory.java
similarity index 68%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMInteriorFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInteriorFactory.java
index 77c6e3a..1674554 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMInteriorFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInteriorFactory.java
@@ -13,14 +13,14 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInterior;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInteriorFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrameFactory;
 
-public class BTreeNSMInteriorFactory implements IBTreeFrameInteriorFactory {
+public class BTreeNSMInteriorFactory implements IBTreeInteriorFrameFactory {
 	@Override
-	public IBTreeFrameInterior getFrame() {		
+	public IBTreeInteriorFrame getFrame() {		
 		return new BTreeNSMInterior();
 	}	
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMLeaf.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeaf.java
similarity index 90%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMLeaf.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeaf.java
index 47e1f0d..da0d52a 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMLeaf.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeaf.java
@@ -13,14 +13,17 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
 import java.nio.ByteBuffer;
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrame;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
+import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeException;
+import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 
-public class BTreeNSMLeaf extends BTreeNSM implements IBTreeFrameLeaf {    
+public class BTreeNSMLeaf extends BTreeNSM implements IBTreeLeafFrame {    
 	protected static final int prevLeafOff = smFlagOff + 1;
 	protected static final int nextLeafOff = prevLeafOff + 4;
 	
@@ -57,7 +60,7 @@
 
 	@Override
 	public void insert(byte[] data, MultiComparator cmp) throws Exception {		
-		int slotOff = slotManager.findSlot(buf, data, cmp, false);
+		int slotOff = slotManager.findSlot(data, cmp, false);
 		boolean isDuplicate = true;
 		
 		if (slotOff < 0) isDuplicate = false; // greater than all existing keys
@@ -92,7 +95,7 @@
 	public int split(IBTreeFrame rightFrame, byte[] data, MultiComparator cmp, SplitKey splitKey) throws Exception {
 		
 		// before doing anything check if key already exists
-		int slotOff = slotManager.findSlot(buf, data, cmp, true);
+		int slotOff = slotManager.findSlot(data, cmp, true);
 		if (slotOff >= 0) {			
 			if (cmp.compare(data, 0, buf.array(), slotManager.getRecOff(slotOff)) == 0) {
 				throw new BTreeException("Inserting duplicate key into unique index");
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFactory.java
similarity index 71%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMLeafFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFactory.java
index 4545244..557d8ca 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeNSMLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFactory.java
@@ -13,14 +13,14 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.impls;
+package edu.uci.ics.hyracks.storage.am.btree.frames;
 
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeafFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
 
-public class BTreeNSMLeafFactory implements IBTreeFrameLeafFactory {
+public class BTreeNSMLeafFactory implements IBTreeLeafFrameFactory {
 	@Override
-	public IBTreeFrameLeaf getFrame() {		
+	public IBTreeLeafFrame getFrame() {		
 		return new BTreeNSMLeaf();
 	}
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java
index f51823f..c8f4b25 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java
@@ -21,22 +21,22 @@
 
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrame;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFrameCompressor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IPrefixSlotManager;
 import edu.uci.ics.hyracks.storage.am.btree.api.ISlotManager;
-import edu.uci.ics.hyracks.storage.am.btree.api.SpaceStatus;
 import edu.uci.ics.hyracks.storage.am.btree.compressors.FieldPrefixCompressor;
 import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeException;
 import edu.uci.ics.hyracks.storage.am.btree.impls.FieldIterator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.FieldPrefixSlotManager;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.SlotOffRecOff;
+import edu.uci.ics.hyracks.storage.am.btree.impls.SpaceStatus;
 import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
-public class FieldPrefixNSMLeaf implements IBTreeFrameLeaf {
+public class FieldPrefixNSMLeaf implements IBTreeLeafFrame {
 	
     protected static final int pageLsnOff = 0;                              // 0
     protected static final int numRecordsOff = pageLsnOff + 4;              // 4    
@@ -152,7 +152,7 @@
     
     @Override
     public void delete(byte[] data, MultiComparator cmp, boolean exactDelete) throws Exception {        
-        int slot = slotManager.findSlot(buf, data, cmp, true);
+        int slot = slotManager.findSlot(data, cmp, true);
         int recSlotNum = slotManager.decodeSecondSlotField(slot);
         if(recSlotNum == FieldPrefixSlotManager.GREATEST_SLOT) {
             throw new BTreeException("Key to be deleted does not exist.");   
@@ -275,7 +275,7 @@
     
     @Override
     public void insert(byte[] data, MultiComparator cmp) throws Exception {    	
-    	int slot = slotManager.findSlot(buf, data, cmp, false);        
+    	int slot = slotManager.findSlot(data, cmp, false);        
         slot = slotManager.insertSlot(slot, buf.getInt(freeSpaceOff));
         
         int suffixSize = data.length;
@@ -444,7 +444,7 @@
     	FieldPrefixNSMLeaf rf = (FieldPrefixNSMLeaf)rightFrame;
     	
     	// before doing anything check if key already exists
-		int slot = slotManager.findSlot(buf, data, cmp, true);
+		int slot = slotManager.findSlot(data, cmp, true);
 		int recSlotNum = slotManager.decodeSecondSlotField(slot);	
 		if(recSlotNum != FieldPrefixSlotManager.GREATEST_SLOT) {
 			int prefixSlotNum = slotManager.decodeFirstSlotField(slot);				
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java
index 5540b50..8b4521a 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java
@@ -15,12 +15,12 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.frames;
 
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeafFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
 
-public class FieldPrefixNSMLeafFactory implements IBTreeFrameLeafFactory {
+public class FieldPrefixNSMLeafFactory implements IBTreeLeafFrameFactory {
 	@Override
-	public IBTreeFrameLeaf getFrame() {		
+	public IBTreeLeafFrame getFrame() {		
 		return new FieldPrefixNSMLeaf();
 	}
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
index ee1fff9..5453409 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
@@ -22,12 +22,12 @@
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeCursor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrame;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInterior;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInteriorFactory;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeafFactory;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMeta;
-import edu.uci.ics.hyracks.storage.am.btree.api.SpaceStatus;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrameFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
+import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInterior;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 import edu.uci.ics.hyracks.storage.common.file.FileInfo;
@@ -43,8 +43,8 @@
     
     private final IBufferCache bufferCache;
     private int fileId;
-    private final IBTreeFrameInteriorFactory interiorFrameFactory;
-    private final IBTreeFrameLeafFactory leafFrameFactory;    
+    private final IBTreeInteriorFrameFactory interiorFrameFactory;
+    private final IBTreeLeafFrameFactory leafFrameFactory;    
     private final MultiComparator cmp;
     private final ReadWriteLock treeLatch;
     
@@ -79,8 +79,8 @@
         return strBuilder.toString();
     }
 
-    public BTree(IBufferCache bufferCache, IBTreeFrameInteriorFactory interiorFrameFactory,
-            IBTreeFrameLeafFactory leafFrameFactory, MultiComparator cmp) {
+    public BTree(IBufferCache bufferCache, IBTreeInteriorFrameFactory interiorFrameFactory,
+            IBTreeLeafFrameFactory leafFrameFactory, MultiComparator cmp) {
         this.bufferCache = bufferCache;
         this.interiorFrameFactory = interiorFrameFactory;
         this.leafFrameFactory = leafFrameFactory;       
@@ -88,7 +88,7 @@
         this.treeLatch = new ReentrantReadWriteLock(true);
     }
     
-    public void create(int fileId, IBTreeFrameLeaf leafFrame, IBTreeFrameMeta metaFrame) throws Exception {
+    public void create(int fileId, IBTreeLeafFrame leafFrame, IBTreeMetaDataFrame metaFrame) throws Exception {
         // initialize meta data page
         ICachedPage metaNode = bufferCache.pin(FileInfo.getDiskPageId(fileId, metaDataPage), false);
         pins++;
@@ -132,7 +132,7 @@
         fileId = -1;
     }
 
-    private int getFreePage(IBTreeFrameMeta metaFrame) throws Exception {
+    private int getFreePage(IBTreeMetaDataFrame metaFrame) throws Exception {
         ICachedPage metaNode = bufferCache.pin(FileInfo.getDiskPageId(fileId, metaDataPage), false);
         pins++;
         
@@ -204,7 +204,7 @@
         ctx.freePages.clear();
     }
 
-    private void addFreePage(IBTreeFrameMeta metaFrame, int freePage) throws Exception {
+    private void addFreePage(IBTreeMetaDataFrame metaFrame, int freePage) throws Exception {
         // root page is special, don't add it to free pages
         if (freePage == rootPage) return;
         
@@ -263,12 +263,12 @@
         }
     }
     
-    public void printTree(IBTreeFrameLeaf leafFrame, IBTreeFrameInterior interiorFrame) throws Exception {
+    public void printTree(IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame) throws Exception {
         printTree(rootPage, null, false, leafFrame, interiorFrame);
     }
 
-    public void printTree(int pageId, ICachedPage parent, boolean unpin, IBTreeFrameLeaf leafFrame,
-            IBTreeFrameInterior interiorFrame) throws Exception {
+    public void printTree(int pageId, ICachedPage parent, boolean unpin, IBTreeLeafFrame leafFrame,
+            IBTreeInteriorFrame interiorFrame) throws Exception {
         
         ICachedPage node = bufferCache.pin(FileInfo.getDiskPageId(fileId, pageId), false);
         pins++;
@@ -344,7 +344,7 @@
         }
     }
 
-    public void diskOrderScan(BTreeDiskOrderScanCursor cursor, IBTreeFrameLeaf leafFrame, IBTreeFrameMeta metaFrame) throws Exception {
+    public void diskOrderScan(BTreeDiskOrderScanCursor cursor, IBTreeLeafFrame leafFrame, IBTreeMetaDataFrame metaFrame) throws Exception {
         int currentPageId = rootPage + 1;
         int maxPageId = -1;
         
@@ -374,8 +374,8 @@
         cursor.open(page, null);
     }
     
-    public void search(IBTreeCursor cursor, RangePredicate pred, IBTreeFrameLeaf leafFrame,
-            IBTreeFrameInterior interiorFrame) throws Exception {
+    public void search(IBTreeCursor cursor, RangePredicate pred, IBTreeLeafFrame leafFrame,
+            IBTreeInteriorFrame interiorFrame) throws Exception {
         BTreeOpContext ctx = new BTreeOpContext();
         ctx.op = BTreeOp.BTO_SEARCH;
         ctx.leafFrame = leafFrame;
@@ -493,8 +493,8 @@
         }
     }
 
-    public void insert(byte[] data, IBTreeFrameLeaf leafFrame, IBTreeFrameInterior interiorFrame,
-            IBTreeFrameMeta metaFrame) throws Exception {
+    public void insert(byte[] data, IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame,
+            IBTreeMetaDataFrame metaFrame) throws Exception {
         BTreeOpContext ctx = new BTreeOpContext();
         ctx.op = BTreeOp.BTO_INSERT;
         ctx.leafFrame = leafFrame;
@@ -586,7 +586,7 @@
     				rightNode.acquireWriteLatch();
     				writeLatchesAcquired++;
     				try {
-    					IBTreeFrameLeaf rightFrame = leafFrameFactory.getFrame();
+    					IBTreeLeafFrame rightFrame = leafFrameFactory.getFrame();
     					rightFrame.setPage(rightNode);
     					rightFrame.initBuffer((byte) 0);
 
@@ -723,8 +723,8 @@
         }
     }
 
-    public void delete(byte[] data, IBTreeFrameLeaf leafFrame, IBTreeFrameInterior interiorFrame,
-            IBTreeFrameMeta metaFrame) throws Exception {
+    public void delete(byte[] data, IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame,
+            IBTreeMetaDataFrame metaFrame) throws Exception {
         BTreeOpContext ctx = new BTreeOpContext();
         ctx.op = BTreeOp.BTO_DELETE;
         ctx.leafFrame = leafFrame;
@@ -781,7 +781,7 @@
 
         // will this leaf become empty?
         if (ctx.leafFrame.getNumRecords() == 1) {
-            IBTreeFrameLeaf siblingFrame = leafFrameFactory.getFrame();
+            IBTreeLeafFrame siblingFrame = leafFrameFactory.getFrame();
 
             ICachedPage leftNode = null;
             ICachedPage rightNode = null;
@@ -1144,12 +1144,12 @@
         // for
         // each
         // level
-        IBTreeFrameLeaf leafFrame;
-        IBTreeFrameInterior interiorFrame;
-        IBTreeFrameMeta metaFrame;
+        IBTreeLeafFrame leafFrame;
+        IBTreeInteriorFrame interiorFrame;
+        IBTreeMetaDataFrame metaFrame;
 
-        public BulkLoadContext(float fillFactor, IBTreeFrameLeaf leafFrame, IBTreeFrameInterior interiorFrame,
-                IBTreeFrameMeta metaFrame) throws Exception {
+        public BulkLoadContext(float fillFactor, IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame,
+                IBTreeMetaDataFrame metaFrame) throws Exception {
             NodeFrontier leafFrontier = new NodeFrontier();
             leafFrontier.pageId = getFreePage(metaFrame);
             leafFrontier.page = bufferCache.pin(FileInfo.getDiskPageId(fileId, leafFrontier.pageId), bulkNewPage);
@@ -1225,14 +1225,14 @@
     }
     
     // assumes btree has been created and opened
-    public BulkLoadContext beginBulkLoad(float fillFactor, IBTreeFrameLeaf leafFrame, IBTreeFrameInterior interiorFrame, IBTreeFrameMeta metaFrame) throws Exception {
+    public BulkLoadContext beginBulkLoad(float fillFactor, IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame, IBTreeMetaDataFrame metaFrame) throws Exception {
         BulkLoadContext ctx = new BulkLoadContext(fillFactor, leafFrame, interiorFrame, metaFrame);        
         return ctx;
     }
     
     public void bulkLoadAddRecord(BulkLoadContext ctx, byte[] record) throws Exception {                        
         NodeFrontier leafFrontier = ctx.nodeFrontiers.get(0);
-        IBTreeFrameLeaf leafFrame = ctx.leafFrame;
+        IBTreeLeafFrame leafFrame = ctx.leafFrame;
         
         int spaceNeeded = record.length + ctx.slotSize;
         if (leafFrontier.bytesInserted + spaceNeeded > ctx.leafMaxBytes) {
@@ -1284,11 +1284,11 @@
         currentLevel = (byte) ctx.nodeFrontiers.size();
     }
     
-    public IBTreeFrameInteriorFactory getInteriorFrameFactory() {
+    public IBTreeInteriorFrameFactory getInteriorFrameFactory() {
         return interiorFrameFactory;
     }
 
-    public IBTreeFrameLeafFactory getLeafFrameFactory() {
+    public IBTreeLeafFrameFactory getLeafFrameFactory() {
         return leafFrameFactory;
     }
     
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java
index 56c4d73..ecb95fe 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java
@@ -16,7 +16,7 @@
 package edu.uci.ics.hyracks.storage.am.btree.impls;
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeCursor;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
@@ -32,10 +32,10 @@
     int currentPageId = -1;
     int maxPageId = -1; // TODO: figure out how to scan to the end of file, this is dirty and may not with concurrent updates
     private ICachedPage page = null;
-    private IBTreeFrameLeaf frame = null;
+    private IBTreeLeafFrame frame = null;
     private IBufferCache bufferCache = null;
     
-    public BTreeDiskOrderScanCursor(IBTreeFrameLeaf frame) {
+    public BTreeDiskOrderScanCursor(IBTreeLeafFrame frame) {
         this.frame = frame;
     }
     
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java
index 085690f..9a81c96 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java
@@ -19,15 +19,15 @@
 import java.util.Stack;
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeCursor;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInterior;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMeta;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
 
 public final class BTreeOpContext {
 	public BTreeOp op;
-	public IBTreeFrameLeaf leafFrame;
-	public IBTreeFrameInterior interiorFrame;
-	public IBTreeFrameMeta metaFrame;
+	public IBTreeLeafFrame leafFrame;
+	public IBTreeInteriorFrame interiorFrame;
+	public IBTreeMetaDataFrame metaFrame;
 	public IBTreeCursor cursor;
 	public RangePredicate pred;	
 	public SplitKey splitKey;
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java
index 6a7c585..6ccdf16 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java
@@ -16,7 +16,7 @@
 package edu.uci.ics.hyracks.storage.am.btree.impls;
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeCursor;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.ISearchPredicate;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
@@ -29,10 +29,10 @@
 	private int recordOffset = -1;
 	private int fileId = -1;
 	private ICachedPage page = null;
-	private IBTreeFrameLeaf frame = null;
+	private IBTreeLeafFrame frame = null;
 	private IBufferCache bufferCache = null;
 	
-	public BTreeRangeSearchCursor(IBTreeFrameLeaf frame) {
+	public BTreeRangeSearchCursor(IBTreeLeafFrame frame) {
 		this.frame = frame;		
 	}
 	
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java
index 31637af..3b12e6f 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java
@@ -67,7 +67,7 @@
 	    return FieldPrefixSlotManager.RECORD_UNCOMPRESSED;
 	}
 	
-	public int findSlot(ByteBuffer buf, byte[] data, MultiComparator multiCmp, boolean exact) {				
+	public int findSlot(byte[] data, MultiComparator multiCmp, boolean exact) {				
 		if(frame.getNumRecords() <= 0) encodeSlotFields(RECORD_UNCOMPRESSED, GREATEST_SLOT);
 								
 	    int prefixMid;
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManager.java
index 5867adc..bd4acba 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManager.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManager.java
@@ -15,8 +15,6 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.impls;
 
-import java.nio.ByteBuffer;
-
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.ISlotManager;
 
@@ -27,7 +25,7 @@
 		
 	// TODO: mix in interpolation search
 	@Override
-	public int findSlot(ByteBuffer buf, byte[] data, MultiComparator multiCmp, boolean exact) {
+	public int findSlot(byte[] data, MultiComparator multiCmp, boolean exact) {
 		if(frame.getNumRecords() <= 0) return -1;
 		
 		int mid;
@@ -38,7 +36,7 @@
             mid = (begin + end) / 2;
         	int slotOff = getSlotOff(mid);        	
         	int recOff = getRecOff(slotOff);
-        	int cmp = multiCmp.compare(data, 0, buf.array(), recOff);
+        	int cmp = multiCmp.compare(data, 0, frame.getBuffer().array(), recOff);
         	if(cmp < 0)
         		end = mid - 1;
         	else if(cmp > 0)
@@ -52,7 +50,7 @@
         
         int slotOff = getSlotOff(begin);
         int recOff = getRecOff(slotOff);
-        if(multiCmp.compare(data, 0, buf.array(), recOff)  < 0)
+        if(multiCmp.compare(data, 0, frame.getBuffer().array(), recOff)  < 0)
         	return slotOff;
         else
         	return -1;		
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManagerFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManagerFactory.java
deleted file mode 100644
index 099da98..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/OrderedSlotManagerFactory.java
+++ /dev/null
@@ -1,27 +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.btree.impls;
-
-import edu.uci.ics.hyracks.storage.am.btree.api.ISlotManager;
-import edu.uci.ics.hyracks.storage.am.btree.api.ISlotManagerFactory;
-
-public class OrderedSlotManagerFactory implements ISlotManagerFactory {
-	
-	@Override
-	public ISlotManager getSlotManager() {
-		return new OrderedSlotManager();
-	}	
-}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/SpaceStatus.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/SpaceStatus.java
similarity index 93%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/SpaceStatus.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/SpaceStatus.java
index a34c717..6cb9999 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/SpaceStatus.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/SpaceStatus.java
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 
-package edu.uci.ics.hyracks.storage.am.btree.api;
+package edu.uci.ics.hyracks.storage.am.btree.impls;
 
 public enum SpaceStatus {
 	INSUFFICIENT_SPACE,
diff --git a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java
index 47acfa9..05a929d 100644
--- a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java
+++ b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java
@@ -29,7 +29,6 @@
 import edu.uci.ics.hyracks.dataflow.common.comm.io.ByteArrayAccessibleOutputStream;
 import edu.uci.ics.hyracks.dataflow.common.data.comparators.IntegerBinaryComparatorFactory;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
-import edu.uci.ics.hyracks.storage.am.btree.api.IComparator;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IPrefixSlotManager;
 import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
diff --git a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java
index 49fc100..e5bc1b6 100644
--- a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java
+++ b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java
@@ -30,18 +30,18 @@
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeCursor;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInterior;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameInteriorFactory;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeaf;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameLeafFactory;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMeta;
-import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeFrameMetaFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrameFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
+import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrameFactory;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
+import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeMetaFactory;
+import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFactory;
+import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMLeafFactory;
 import edu.uci.ics.hyracks.storage.am.btree.impls.BTree;
 import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeDiskOrderScanCursor;
-import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeMetaFactory;
-import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeNSMInteriorFactory;
-import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeNSMLeafFactory;
 import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeRangeSearchCursor;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.RangePredicate;
@@ -100,13 +100,13 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
         
-        IBTreeFrameLeafFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeFrameInteriorFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeFrameMetaFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
         
-        IBTreeFrameLeaf leafFrame = leafFrameFactory.getFrame();
-        IBTreeFrameInterior interiorFrame = interiorFrameFactory.getFrame();
-        IBTreeFrameMeta metaFrame = metaFrameFactory.getFrame();        
+        IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
+        IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
+        IBTreeMetaDataFrame metaFrame = metaFrameFactory.getFrame();        
         
         IFieldAccessor[] fields = new IFieldAccessor[2];
         fields[0] = new Int32Accessor(); // key field
@@ -262,13 +262,13 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
                 
-        IBTreeFrameLeafFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeFrameInteriorFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeFrameMetaFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
         
-        IBTreeFrameLeaf leafFrame = leafFrameFactory.getFrame();
-        IBTreeFrameInterior interiorFrame = interiorFrameFactory.getFrame();
-        IBTreeFrameMeta metaFrame = metaFrameFactory.getFrame();   
+        IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
+        IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
+        IBTreeMetaDataFrame metaFrame = metaFrameFactory.getFrame();   
         
         IFieldAccessor[] fields = new IFieldAccessor[3];
         fields[0] = new Int32Accessor(); // key field 1
@@ -404,13 +404,13 @@
     	FileInfo fi = new FileInfo(fileId, raf);
     	fileManager.registerFile(fi);
     	
-        IBTreeFrameLeafFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeFrameInteriorFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeFrameMetaFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
         
-        IBTreeFrameLeaf leafFrame = leafFrameFactory.getFrame();
-        IBTreeFrameInterior interiorFrame = interiorFrameFactory.getFrame();
-        IBTreeFrameMeta metaFrame = metaFrameFactory.getFrame();   
+        IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
+        IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
+        IBTreeMetaDataFrame metaFrame = metaFrameFactory.getFrame();   
 
     	IFieldAccessor[] fields = new IFieldAccessor[2];
     	fields[0] = new StringAccessor(); // key        
@@ -537,13 +537,13 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
                 
-        IBTreeFrameLeafFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeFrameInteriorFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeFrameMetaFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
         
-        IBTreeFrameLeaf leafFrame = leafFrameFactory.getFrame();
-        IBTreeFrameInterior interiorFrame = interiorFrameFactory.getFrame();
-        IBTreeFrameMeta metaFrame = metaFrameFactory.getFrame();   
+        IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
+        IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
+        IBTreeMetaDataFrame metaFrame = metaFrameFactory.getFrame();   
         
         IFieldAccessor[] fields = new IFieldAccessor[2];
         fields[0] = new StringAccessor(); // key        
@@ -658,13 +658,13 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
         
-        IBTreeFrameLeafFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeFrameInteriorFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeFrameMetaFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
         
-        IBTreeFrameLeaf leafFrame = leafFrameFactory.getFrame();
-        IBTreeFrameInterior interiorFrame = interiorFrameFactory.getFrame();
-        IBTreeFrameMeta metaFrame = metaFrameFactory.getFrame();          
+        IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
+        IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
+        IBTreeMetaDataFrame metaFrame = metaFrameFactory.getFrame();          
 
         int keyLen = 2;
 
@@ -779,13 +779,13 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);       
                 
-        IBTreeFrameLeafFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeFrameInteriorFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeFrameMetaFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
         
-        IBTreeFrameLeaf leafFrame = leafFrameFactory.getFrame();
-        IBTreeFrameInterior interiorFrame = interiorFrameFactory.getFrame();
-        IBTreeFrameMeta metaFrame = metaFrameFactory.getFrame();
+        IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
+        IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
+        IBTreeMetaDataFrame metaFrame = metaFrameFactory.getFrame();
 
         int keyLen = 2;