Version without using B tree.