Cleaned up BTree code