BTree refactored; after code review fixes